pub trait FragmentedBufferMut: FragmentedBuffer {
// Required method
fn with_bytes_mut<R, F>(&mut self, f: F) -> R
where F: for<'a, 'b> FnOnce(FragmentedBytesMut<'a, 'b>) -> R;
// Provided methods
fn zero_range<R>(&mut self, range: R)
where R: RangeBounds<usize> { ... }
fn copy_within<R: RangeBounds<usize>>(&mut self, src: R, dst: usize) { ... }
fn copy_from<B: FragmentedBuffer>(&mut self, other: &B) { ... }
}
Expand description
A FragmentedBuffer
with mutable access to its contents.
Required Methods§
Sourcefn with_bytes_mut<R, F>(&mut self, f: F) -> Rwhere
F: for<'a, 'b> FnOnce(FragmentedBytesMut<'a, 'b>) -> R,
fn with_bytes_mut<R, F>(&mut self, f: F) -> Rwhere
F: for<'a, 'b> FnOnce(FragmentedBytesMut<'a, 'b>) -> R,
Invokes a callback on a mutable view into this buffer’s contents as
FragmentedBytesMut
.
Provided Methods§
Sourcefn zero_range<R>(&mut self, range: R)where
R: RangeBounds<usize>,
fn zero_range<R>(&mut self, range: R)where
R: RangeBounds<usize>,
Sets all bytes in range
to zero.
§Panics
Panics if the provided range
is not within the bounds of this
FragmentedBufferMut
, or if the range is nonsensical (the end precedes
the start).
Sourcefn copy_within<R: RangeBounds<usize>>(&mut self, src: R, dst: usize)
fn copy_within<R: RangeBounds<usize>>(&mut self, src: R, dst: usize)
Copies elements from one part of the FragmentedBufferMut
to another
part of itself.
src
is the range within self
to copy from. dst
is the starting
index of the range within self
to copy to, which will have the same
length as src
. The two ranges may overlap. The ends of the two ranges
must be less than or equal to self.len()
.
§Panics
Panics if either the source or destination range is out of bounds, or if
src
is nonsensical (its end precedes its start).
Sourcefn copy_from<B: FragmentedBuffer>(&mut self, other: &B)
fn copy_from<B: FragmentedBuffer>(&mut self, other: &B)
Copies all the bytes from another FragmentedBuffer
other
into
self
.
§Panics
Panics if self.len() != other.len()
.
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.