.reserve employs some heuristics, which are subject to change, to determine whether it's going to move the data or reallocate. A user concerned with memory usage might want to do something, like flushing out the buffer to I/O, before BytesMut gives up and grows the allocation.
Right now there seems to be no way to achieve this. Maybe there could be a .compact method which is like .reserve minus reallocation, and returns whether it could expand the available space.
.reserve
employs some heuristics, which are subject to change, to determine whether it's going to move the data or reallocate. A user concerned with memory usage might want to do something, like flushing out the buffer to I/O, beforeBytesMut
gives up and grows the allocation.Right now there seems to be no way to achieve this. Maybe there could be a
.compact
method which is like.reserve
minus reallocation, and returns whether it could expand the available space.