-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement WriteColor for std::io::Sink #38
Conversation
Would you like me to add a test? |
src/lib.rs
Outdated
@@ -1450,6 +1450,20 @@ impl<W: io::Write> Ansi<W> { | |||
} | |||
} | |||
|
|||
impl WriteColor for io::Sink { | |||
fn supports_color(&self) -> bool { | |||
true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should probably be false
? Why did you return true
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was unsure if there is ever a situation where you absolutely need a sink which supports color. I can change it to false
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would a sink that supports color look like? It never writes anything so it would seem to me that it can't support color?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, sorry I might have mistaken what support_color
meant. I thought support_color
meant you can write colored output to the sink without encountering any problems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, this LGTM, thanks!
This PR addresses #37 by implementing
WriteColor
forstd::io::Sink
. ASink
is a writer which moves data into the void, and can be useful for when you want to measure the performance of a program without including I/O.