diff --git a/crates/anstream/src/auto.rs b/crates/anstream/src/auto.rs index 0976ebb8..9dc56db8 100644 --- a/crates/anstream/src/auto.rs +++ b/crates/anstream/src/auto.rs @@ -1,6 +1,5 @@ #[cfg(feature = "auto")] use crate::ColorChoice; -use crate::IsTerminal; use crate::RawStream; use crate::StripStream; #[cfg(all(windows, feature = "wincon"))] @@ -158,16 +157,6 @@ fn choice(raw: &dyn RawStream) -> ColorChoice { } } -impl IsTerminal for AutoStream -where - S: RawStream, -{ - #[inline] - fn is_terminal(&self) -> bool { - self.is_terminal() - } -} - impl AutoStream { /// Get exclusive access to the `AutoStream` /// diff --git a/crates/anstream/src/stream.rs b/crates/anstream/src/stream.rs index e6f5dde5..754c5b57 100644 --- a/crates/anstream/src/stream.rs +++ b/crates/anstream/src/stream.rs @@ -21,7 +21,7 @@ impl RawStream for std::fs::File {} impl RawStream for crate::Buffer {} -pub trait IsTerminal { +pub trait IsTerminal: private::Sealed { fn is_terminal(&self) -> bool; } diff --git a/crates/anstream/src/strip.rs b/crates/anstream/src/strip.rs index 3b464445..3d3c6cd0 100644 --- a/crates/anstream/src/strip.rs +++ b/crates/anstream/src/strip.rs @@ -1,5 +1,4 @@ use crate::adapter::StripBytes; -use crate::IsTerminal; use crate::RawStream; /// Only pass printable data to the inner `Write` @@ -67,16 +66,6 @@ impl StripStream { } } -impl IsTerminal for StripStream -where - S: RawStream, -{ - #[inline] - fn is_terminal(&self) -> bool { - self.is_terminal() - } -} - impl std::io::Write for StripStream where S: RawStream, diff --git a/crates/anstream/src/wincon.rs b/crates/anstream/src/wincon.rs index b9be2257..0e4f0d29 100644 --- a/crates/anstream/src/wincon.rs +++ b/crates/anstream/src/wincon.rs @@ -1,5 +1,4 @@ use crate::adapter::WinconBytes; -use crate::IsTerminal; use crate::RawStream; /// Only pass printable data to the inner `Write` @@ -71,16 +70,6 @@ impl WinconStream { } } -impl IsTerminal for WinconStream -where - S: RawStream, -{ - #[inline] - fn is_terminal(&self) -> bool { - self.is_terminal() - } -} - impl std::io::Write for WinconStream where S: RawStream,