summaryrefslogtreecommitdiffstats
path: root/vendor/anstream/src/raw.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/anstream/src/raw.rs')
-rw-r--r--vendor/anstream/src/raw.rs42
1 files changed, 42 insertions, 0 deletions
diff --git a/vendor/anstream/src/raw.rs b/vendor/anstream/src/raw.rs
new file mode 100644
index 000000000..d81db28c1
--- /dev/null
+++ b/vendor/anstream/src/raw.rs
@@ -0,0 +1,42 @@
+/// Required functionality for underlying [`std::io::Write`] for adaptation
+#[cfg(not(any(feature = "auto", all(windows, feature = "wincon"))))]
+pub trait RawStream: std::io::Write + private::Sealed {}
+
+/// Required functionality for underlying [`std::io::Write`] for adaptation
+#[cfg(all(feature = "auto", not(all(windows, feature = "wincon"))))]
+pub trait RawStream: std::io::Write + is_terminal::IsTerminal + private::Sealed {}
+
+/// Required functionality for underlying [`std::io::Write`] for adaptation
+#[cfg(all(not(feature = "auto"), all(windows, feature = "wincon")))]
+pub trait RawStream: std::io::Write + anstyle_wincon::WinconStream + private::Sealed {}
+
+/// Required functionality for underlying [`std::io::Write`] for adaptation
+#[cfg(all(feature = "auto", all(windows, feature = "wincon")))]
+pub trait RawStream:
+ std::io::Write + is_terminal::IsTerminal + anstyle_wincon::WinconStream + private::Sealed
+{
+}
+
+impl RawStream for std::io::Stdout {}
+
+impl RawStream for std::io::StdoutLock<'static> {}
+
+impl RawStream for std::io::Stderr {}
+
+impl RawStream for std::io::StderrLock<'static> {}
+
+impl RawStream for crate::Buffer {}
+
+mod private {
+ pub trait Sealed {}
+
+ impl Sealed for std::io::Stdout {}
+
+ impl Sealed for std::io::StdoutLock<'static> {}
+
+ impl Sealed for std::io::Stderr {}
+
+ impl Sealed for std::io::StderrLock<'static> {}
+
+ impl Sealed for crate::Buffer {}
+}