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
bytes_mut.reserve(..) makes the guarantee that the underlying allocation will be reclaimed when bytes_mut is the only remaining handle to it. However, when it isn't the only remaining handle, new space is allocated and the handle to the old allocation is discarded.
BytesMut should offer a method to request that the underlying allocation be reclaimed without discarding the old allocation when the attempt fails. Something along the lines of the following.
implBytesMut{/// Attempts to reclaim the underlying allocation.////// The attempt will succeed iff this is the last remaining handle/// to the allocation.////// When the attempt succeeds, an empty `BytesMut` with the full/// capacity of the allocation is returned. Otherwise, the original/// handle is returned.pubfntry_reclaim(self) -> Result<Self,Self>;}
I'd be happy to implement this proposal and file a PR for it.
The text was updated successfully, but these errors were encountered:
bytes_mut.reserve(..)
makes the guarantee that the underlying allocation will be reclaimed whenbytes_mut
is the only remaining handle to it. However, when it isn't the only remaining handle, new space is allocated and the handle to the old allocation is discarded.BytesMut
should offer a method to request that the underlying allocation be reclaimed without discarding the old allocation when the attempt fails. Something along the lines of the following.I'd be happy to implement this proposal and file a PR for it.
The text was updated successfully, but these errors were encountered: