pub trait GrowBufferMut: GrowBuffer + FragmentedBufferMut {
// Required method
fn with_parts_mut<O, F>(&mut self, f: F) -> O
where F: for<'a, 'b> FnOnce(&'a mut [u8], FragmentedBytesMut<'a, 'b>, &'a mut [u8]) -> O;
// Provided methods
fn grow_front_zero(&mut self, n: usize) { ... }
fn grow_back_zero(&mut self, n: usize) { ... }
fn reset_zero(&mut self) { ... }
}
Expand description
A GrowBuffer
which provides mutable access to its contents.
While a GrowBuffer
allows the ranges covered by its prefix, body, and
suffix to be modified, it only provides immutable access to their contents.
A GrowBufferMut
, on the other hand, provides mutable access to the
contents of its prefix, body, and suffix.
Required Methods§
Sourcefn with_parts_mut<O, F>(&mut self, f: F) -> O
fn with_parts_mut<O, F>(&mut self, f: F) -> O
Gets a mutable view into the parts of this GrowBufferMut
.
Calls f
, passing the prefix, body, and suffix as arguments (in that
order).
Provided Methods§
Sourcefn grow_front_zero(&mut self, n: usize)
fn grow_front_zero(&mut self, n: usize)
Extends the front of the body towards the beginning of the buffer, zeroing the new bytes.
grow_front_zero
calls GrowBuffer::grow_front
and sets the
newly-added bytes to 0. This can be useful when serializing to ensure
that the contents of packets previously stored in the buffer are not
leaked.
Sourcefn grow_back_zero(&mut self, n: usize)
fn grow_back_zero(&mut self, n: usize)
Extends the back of the body towards the end of the buffer, zeroing the new bytes.
grow_back_zero
calls GrowBuffer::grow_back
and sets the
newly-added bytes to 0. This can be useful when serializing to ensure
that the contents of packets previously stored in the buffer are not
leaked.
Sourcefn reset_zero(&mut self)
fn reset_zero(&mut self)
Resets the body to be equal to the entire buffer, zeroing the new bytes.
Like GrowBuffer::reset
, reset_zero
consumes the entire prefix and
suffix, adding them to the body. It sets these bytes to 0. This can be
useful when serializing to ensure that the contents of packets
previously stored in the buffer are not leaked.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.