pub struct SharedAlignedBuffer { /* private fields */ }
Expand description
Shared aligned buffer for executor purposes.
See OwnedAlignedBuffer
for a version that can be mutated.
Data is aligned to 16 bytes (128 bits), which is the largest alignment required by primitive
types and by extension any type that implements TrivialType
/IoType
.
NOTE: Counter for number of shared instances is u32
and will wrap around if exceeded breaking
internal invariants (which is extremely unlikely, but still).
Implementations§
Sourcepub fn from_bytes(bytes: &[u8]) -> Self
pub fn from_bytes(bytes: &[u8]) -> Self
Sourcepub fn into_owned(self) -> OwnedAlignedBuffer
pub fn into_owned(self) -> OwnedAlignedBuffer
Convert into owned buffer.
If this is the last shared instance, then allocation will be reused, otherwise new allocation will be created.
Returns None
if there exit other shared instances.
pub fn as_slice(&self) -> &[u8] ⓘ
pub fn as_ptr(&self) -> *const u8
pub fn is_empty(&self) -> bool
pub fn len(&self) -> u32
Trait Implementations§
Source§fn clone(&self) -> SharedAlignedBuffer
fn clone(&self) -> SharedAlignedBuffer
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§fn default() -> SharedAlignedBuffer
fn default() -> SharedAlignedBuffer
Returns the “default value” for a type. Read more
Auto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more