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.
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 have a tool which formats output and error messages on the terminal depending on the terminal size and therefore needs to query
io::IsTerminaloften. I have a traitRenderTarget: io::Write + io::IsTerminalwhich is used throughout the code.Today I had the need to pass
io::sink()to a function expecting aRenderTargetbutio::sink()does not implementio::IsTerminal, and I cannot implement the latter for a wrapper type because it is sealed.So I'm out of luck. I've found an ugly workaround but I think it would be harmless to have
io::sink()implementio::IsTerminalalways returningfalse.