bytes
bytes copied to clipboard
Know ahead of time whether `.reserve` will reallocate
.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.