pub trait BufferProvider {
// Required methods
fn alloc(&self, len: usize) -> Result<Allocation, AllocError>;
fn dealloc(&self, addr: u64) -> Result<(), AllocError>;
// Provided methods
fn max_alloc_len(&self) -> usize { ... }
fn reset(&self) { ... }
fn alloc_sg(
&self,
total_len: usize,
) -> Result<SmallVec<[Allocation; 4]>, AllocError> { ... }
}Expand description
Trait for buffer providers.
Required Methods§
Sourcefn alloc(&self, len: usize) -> Result<Allocation, AllocError>
fn alloc(&self, len: usize) -> Result<Allocation, AllocError>
Allocate one buffer that can hold at least len bytes.
Provided Methods§
Sourcefn max_alloc_len(&self) -> usize
fn max_alloc_len(&self) -> usize
Preferred maximum size of one allocation segment.
Sourcefn alloc_sg(
&self,
total_len: usize,
) -> Result<SmallVec<[Allocation; 4]>, AllocError>
fn alloc_sg( &self, total_len: usize, ) -> Result<SmallVec<[Allocation; 4]>, AllocError>
Allocate scatter/gather segments for a logical payload of total_len bytes.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".