pub trait AsBytes<'a> {
const SLICE_COUNT: usize;
// Required method
fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8]);
// Provided method
fn as_bytes(&self) -> impl Iterator<Item = (u64, &'a [u8])> { ... }
}Expand description
A type that can be viewed as byte slices with lifetime 'a.
Implementors of this trait almost certainly reference the lifetime 'a themselves.
Required Associated Constants§
Sourceconst SLICE_COUNT: usize
const SLICE_COUNT: usize
The number of byte slices this type produces.
Required Methods§
Sourcefn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])
fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])
Returns the index-th byte slice (alignment, data) by random access.
Each composite type dispatches on compile-time-constant SLICE_COUNT
boundaries, so LLVM can constant-fold the branch chain when the caller
iterates 0..SLICE_COUNT.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".