Skip to content

Commit

Permalink
feat(wincon): Allow querying is_terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Aug 23, 2023
1 parent 4b83bfc commit 3b26d6b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resolver = "2"
[workspace.package]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.64.0" # MSRV
rust-version = "1.70.0" # MSRV
include = [
"build.rs",
"src/**/*",
Expand Down
13 changes: 13 additions & 0 deletions crates/anstyle-wincon/src/console.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,24 @@ where
Ok(())
}

fn as_stream(&self) -> &S {
self.stream.as_ref().unwrap()
}

fn as_stream_mut(&mut self) -> &mut S {
self.stream.as_mut().unwrap()
}
}

impl<S> Console<S>
where
S: crate::WinconStream + std::io::Write + std::io::IsTerminal,
{
pub fn is_terminal(&self) -> bool {
std::io::IsTerminal::is_terminal(self.as_stream())
}
}

impl<S> Drop for Console<S>
where
S: crate::WinconStream + std::io::Write,
Expand Down

0 comments on commit 3b26d6b

Please sign in to comment.