You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Writer<Vec<u8>> could trivially implement Into<String>, Into<Vec<u8>>, AsRef<str> and AsRef<[u8]>, but doesn't. This would be good for generic programming, since taking an &T where T: AsRef<Foo>, or a T where T: Into<Foo> are extremely commmon idioms in Rust.
The text was updated successfully, but these errors were encountered:
jFransham
changed the title
Implement Into/AsRef for Writer when appropriate
Implement std conversion traits for Writer when appropriate
Sep 26, 2016
I actually disagree with implementing the Into traits, since that requires the writer to not flush its internal buffer or to flush the buffer and ignore the error or to flush the buffer and panic on error.
Could you expand on the use cases for adding these APIs (including AsRef)?
I'm going to close this. If there are specific concrete use cases for these, then we can revisit it, but I'm generally opposed to "add a bunch of generics because we can" style of API design.
Writer<Vec<u8>>
could trivially implementInto<String>
,Into<Vec<u8>>
,AsRef<str>
andAsRef<[u8]>
, but doesn't. This would be good for generic programming, since taking an&T
whereT: AsRef<Foo>
, or aT
whereT: Into<Foo>
are extremely commmon idioms in Rust.The text was updated successfully, but these errors were encountered: