pub trait ByteSink: Debug {
// Required methods
fn len(&self) -> u64;
fn write_at(
&mut self,
offset: u64,
source: &[u8],
) -> Result<(), BackendError>;
// Provided methods
fn is_empty(&self) -> bool { ... }
fn as_contiguous_mut(&mut self) -> Option<&mut [u8]> { ... }
}Expand description
A bounded byte destination that may be physically segmented.
Providers can write buffer contents directly into validated response regions. The optional
contiguous view avoids callback overhead when the destination is already one slice. Every range
fully contained in 0..len() must be writable for the duration of the backend call.
Required Methods§
Provided Methods§
fn is_empty(&self) -> bool
Sourcefn as_contiguous_mut(&mut self) -> Option<&mut [u8]>
fn as_contiguous_mut(&mut self) -> Option<&mut [u8]>
Mutably borrow the complete logical destination when it is one contiguous region.
A returned slice has length Self::len and represents the same bytes as write_at.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".