pub trait AlignedBuffer:
Sealed
+ Deref<Target = [u8]>
+ StableDeref
+ Debug
+ Send
+ Sync
+ 'static {
type Alignment: Alignment;
// Required methods
fn len(&self) -> u32;
fn is_empty(&self) -> bool;
fn offset(&self) -> u32;
fn allocation_alignment(&self) -> usize;
fn into_shared(self) -> SharedAlignedBuffer<Self::Alignment>;
}Expand description
Common interface of OwnedAlignedBuffer and SharedAlignedBuffer.
Contents don’t move when the buffer is moved, so a buffer can be moved into an operation that accesses its memory, like asynchronous I/O, which then returns it back.
Required Associated Types§
Required Methods§
Sourcefn offset(&self) -> u32
fn offset(&self) -> u32
Offset of the contents from the beginning of the data region of the allocation
Sourcefn allocation_alignment(&self) -> usize
fn allocation_alignment(&self) -> usize
Alignment of the allocation in bytes, see OwnedAlignedBuffer::allocation_alignment()
Convert into shared buffer, which reuses the allocation
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".