Feature request: `std::io::Sink` should implement `std::io::IsTerminal` (returning `false`)

I have a tool which formats output and error messages on the terminal depending on the terminal size and therefore needs to query io::IsTerminal often. I have a trait RenderTarget: io::Write + io::IsTerminal which is used throughout the code.

Today I had the need to pass io::sink() to a function expecting a RenderTarget but io::sink() does not implement io::IsTerminal, and I cannot implement the latter for a wrapper type because it is sealed (by the way, why?).

So I'm out of luck. I've found an ugly workaround but I think it would be harmless to have io::sink() implement io::IsTerminal always returning false.

I'm relatively new to the Rust community so I don't know exactly how to propose such a change (the "New Issue" button on GitHub redirects to this forum for feature requests).

What do you think?

1 Like

Seems reasonable! Please do file an issue, and mark it I-libs-nominated.

Also, we typically seal new traits until there's a reason not to, but I think it'd be reasonable to unseal IsTerminal. So feel free to file a separate issue about that, too.

2 Likes

Nice!

I've opened the issue but probably in a wrong way because I cannot mark it l-libs-nominated as you said.

The issue is: Feature request: `std::io::Sink` should implement `std::io::IsTerminal` (returning `false`) · Issue #161941 · rust-lang/rust · GitHub