This repository has been archived by the owner on May 6, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
BytesMut lacks a direct implementation of std::io::Write #28
Comments
into_writer should work because BufMut is also implemented on &mut BytesMut. So you are passing ownership of the ref, not the value. That being said, unless there is a coherence problem (which I don't think there is) I don't see why BytesMut couldn't impl Writer directly. |
Could you open an issue in the bytes repo and reference this one? |
Sure! Thanks for the quick support! |
Can't you use |
Oh man, sorry. You guys are right. I was mislead. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I'm currently using the
codec
module to implement a framed tansport.Before the refactoring, the
encode
-method of the oldCodec
trait received aVec<u8>
as parameter to serialize the message into.Vec<u8>
directly implementsstd::io::Write
which makes it very easy to put any kind of data into it, since most implementations have some way of writing into an instance ofWrite
.Now the
Vec<u8>
has been replaced byBytesMut
, which lacks a direct implementation of that trait.Write
-compatibility is only archievable throughinto_writer
, which consumes theBytesMut
. Consuming is not possible, though, because the method only receives theBytesMut
by&mut
.Is this desired behavior?
The text was updated successfully, but these errors were encountered: