Skip to content

Commit

Permalink
fix(anstream): Loosen WinconStream's bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Jan 16, 2024
1 parent 6fb197d commit 1c6e9ae
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions crates/anstream/src/wincon.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use crate::adapter::WinconBytes;
use crate::stream::AsLockedWrite;
use crate::stream::RawStream;
use crate::stream::IsTerminal;

/// Only pass printable data to the inner `Write`
#[cfg(feature = "wincon")] // here mostly for documentation purposes
#[derive(Debug)]
pub struct WinconStream<S>
where
S: RawStream,
S: anstyle_wincon::WinconStream,
{
raw: S,
// `WinconBytes` is especially large compared to other variants of `AutoStream`, so boxing it
Expand All @@ -18,7 +18,7 @@ where

impl<S> WinconStream<S>
where
S: RawStream,
S: anstyle_wincon::WinconStream,
{
/// Only pass printable data to the inner `Write`
#[inline]
Expand All @@ -29,12 +29,18 @@ where
}
}

/// Get the wrapped [`RawStream`]
/// Get the wrapped [`anstyle_wincon::WinconStream`]
#[inline]
pub fn into_inner(self) -> S {
self.raw
}
}

impl<S> StripStream<S>
where
S: anstyle_wincon::WinconStream,
S: IsTerminal,
{
#[inline]
pub fn is_terminal(&self) -> bool {
self.raw.is_terminal()
Expand Down

0 comments on commit 1c6e9ae

Please sign in to comment.