-
Notifications
You must be signed in to change notification settings - Fork 287
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 should implicitly grow the internal storage in its BufMut
implementation.
#170
Comments
Can you explain why this is a breaking change? Are users relying on the fact that the buffer does not grow implicitly? |
Yes, users (well, I am at the very least) are relying on the fact that the buffer does not grow implicitly. |
I'm very much in favor of this; or in providing another type ( Even with #199 fixed there are still some places where not extending is imho neither expected nor useful:
Maybe |
If this is functionality that you require immediately, could you define a wrapper type for now? |
I'm in favor with the |
It looks as though there may be a need for two traits serving the extending and non-extending use cases. If there is really just one use case, the preferred behavior should be fixed in the contract of
If slices, |
For the implicitly allocating case, what I would like to have is a type that (to largely reuse the current code) wraps This could allow simple implementations of non-reallocating structured/framed/serde sinks in a way that current Tokio interfaces do not provide. |
BytesMut does not automatically grow its capacity. See: tokio-rs/bytes#170
Any updates on this? |
Still scheduled for 0.5 :) |
To follow up on this, here is I think something like this would be more efficient than serializing into a contiguous growing |
This brings `BytesMut` in line with `Vec<u8>` behavior. In order to fix a test, `BufMutExt::chain_mut` is provided. Withou this, it is not possible to chain two `&mut [u8]`. Closes #170
This brings `BytesMut` in line with `Vec<u8>` behavior. This also fixes an existing bug in BytesMut::bytes_mut that exposes invalid slices. The bug was recently introduced and was only on master and never released to `crates.io`. In order to fix a test, `BufMutExt::chain_mut` is provided. Withou this, it is not possible to chain two `&mut [u8]`. Closes #170
Since tokio-rs#170 is fixed, this is no longer true.
This will bring the implementation in line with that of
Vec
. This is a breaking change.Relates to #131, #77.
The text was updated successfully, but these errors were encountered: