pub trait MaybeContiguousBuffer {
// Required method
fn linearized<'a, 'b>(
&'a mut self,
storage: Option<&'b mut Vec<u8>>,
) -> Option<BufferSlice<'a, 'b>>;
// Provided method
fn unwrap_contiguous<'a>(&'a mut self) -> &'a mut [u8] ⓘ { ... }
}Expand description
A buffer that may be backed by a contiguous memory slice.
Required Methods§
Sourcefn linearized<'a, 'b>(
&'a mut self,
storage: Option<&'b mut Vec<u8>>,
) -> Option<BufferSlice<'a, 'b>>
fn linearized<'a, 'b>( &'a mut self, storage: Option<&'b mut Vec<u8>>, ) -> Option<BufferSlice<'a, 'b>>
Obtains a slice view into the buffer, linearizing into storage if
necessary, or returning None if linearization was required and
storage was None.
Provided Methods§
Sourcefn unwrap_contiguous<'a>(&'a mut self) -> &'a mut [u8] ⓘ
fn unwrap_contiguous<'a>(&'a mut self) -> &'a mut [u8] ⓘ
Obtains a mutable slice into the buffer without linearizing. Panics if called on a buffer that’s not contiguous.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".