-
Notifications
You must be signed in to change notification settings - Fork 288
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
BytesMut lacks an implementation of std::io::Write #77
Comments
This seems fine to me. My only question is if Thoughts @alexcrichton |
Sounds like a good idea to me! I'd grow the buffer internally |
@alexcrichton So BufMut has a writer adapter: BufMut::writer(). That implementation does not grow the buffer. It's built on BufMut::bytes_mut and remaining_mut. |
I don't think a writer that doesn't grow the buffer is of much use. Usually, when I need a writer, I delegate the encoding or writing to some other code. And often I don't know in advance how much such code will write. An example of code that would make sense: use serde_cbor;
use tokio_io::io::Encoder;
struct E;
impl Encoder for E {
...
fn encode(&mut self, item: Self::Item, dst: &mut BytesMut) -> Result<(), Self::Error> {
serde_cbor::to_writer(dst)
}
} Now I have to wrap |
This is now done: https://docs.rs/bytes/0.5.6/bytes/struct.BytesMut.html#impl-Write |
@carllerche I'd say this issue is still unresolved. |
@ColinFinck please see #478 |
Thanks for the reference, @taiki-e |
Copied from tokio-rs/tokio-io#28
The text was updated successfully, but these errors were encountered: