pub struct StructBuffer<T: Sized> { /* private fields */ }
Implementations§
Source§impl<T: Sized + Clone + Copy> StructBuffer<T>
impl<T: Sized + Clone + Copy> StructBuffer<T>
Sourcepub unsafe fn with_ext(ext_size: usize) -> Self
pub unsafe fn with_ext(ext_size: usize) -> Self
Creates a buffer capable to hold the value of type T
plus ext_size
bytes.
§Safety
The buffer is uninitialized!
Sourcepub unsafe fn with_buffer(buffer: Vec<u8>) -> Self
pub unsafe fn with_buffer(buffer: Vec<u8>) -> Self
Creates a StructBuffer for the type T
using supplied buffer
.
§Safety
The buffer size should be >= mem::size_of::
Sourcepub fn with_value(value: &T) -> Self
pub fn with_value(value: &T) -> Self
Creates a StructBuffer for the type T
using supplied T
value.
§Safety
The buffer size should be >= mem::size_of::
pub fn len(&self) -> usize
pub fn raw(&self) -> &T
pub fn raw_mut(&mut self) -> &mut T
pub fn buffer(&self) -> &[u8] ⓘ
pub fn ext_buffer(&self) -> &[u8] ⓘ
pub fn ext_buffer_mut(&mut self) -> &mut [u8] ⓘ
pub fn has_ext_buffer(&self) -> bool
pub fn copy(&self) -> T
pub fn take(self) -> T
Trait Implementations§
Source§impl<T: Sized + Clone + Copy> AsByteSlice for StructBuffer<T>
impl<T: Sized + Clone + Copy> AsByteSlice for StructBuffer<T>
Source§impl<T: Sized + Clone + Copy> AsByteSliceMut for StructBuffer<T>
impl<T: Sized + Clone + Copy> AsByteSliceMut for StructBuffer<T>
Source§impl<T: Clone + Sized> Clone for StructBuffer<T>
impl<T: Clone + Sized> Clone for StructBuffer<T>
Source§fn clone(&self) -> StructBuffer<T>
fn clone(&self) -> StructBuffer<T>
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 moreAuto Trait Implementations§
impl<T> Freeze for StructBuffer<T>
impl<T> RefUnwindSafe for StructBuffer<T>where
T: RefUnwindSafe,
impl<T> Send for StructBuffer<T>where
T: Send,
impl<T> Sync for StructBuffer<T>where
T: Sync,
impl<T> Unpin for StructBuffer<T>where
T: Unpin,
impl<T> UnwindSafe for StructBuffer<T>where
T: UnwindSafe,
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