pub struct RawMemory<T> { /* private fields */ }Expand description
Allocates uninitialized memory on the heap. When it goes out of scope the memory is released. The user has to ensure that the memory is initialized.
Implementations§
Source§impl<T> RawMemory<T>
impl<T> RawMemory<T>
Sourcepub fn new<F>(fill: F) -> RawMemory<T>
pub fn new<F>(fill: F) -> RawMemory<T>
Allocates memory to fit in a T and fills the memory with values provided by the fill callback.
Sourcepub fn new_zeroed() -> RawMemory<T>
pub fn new_zeroed() -> RawMemory<T>
Allocates zeroed memory to fit in a T.
Sourcepub fn new_filled(value: u8) -> RawMemory<T>
pub fn new_filled(value: u8) -> RawMemory<T>
Allocates memory filled with a given value to fit in a T.
Sourcepub fn as_mut_ptr(&self) -> *mut T
pub fn as_mut_ptr(&self) -> *mut T
Returns a mutable pointer to T
Sourcepub unsafe fn assume_init(&self) -> &T
pub unsafe fn assume_init(&self) -> &T
Returns a const reference to T
§Safety
- T must have been constructed manually before calling this function.
Sourcepub unsafe fn assume_init_mut(&mut self) -> &mut T
pub unsafe fn assume_init_mut(&mut self) -> &mut T
Returns a mutable reference to T
§Safety
- T must have been constructed manually before calling this function.
Sourcepub fn as_slice_mut(&mut self) -> &mut [u8]
pub fn as_slice_mut(&mut self) -> &mut [u8]
Returns a mutable slice to the underlying memory
Trait Implementations§
Auto Trait Implementations§
impl<T> !Send for RawMemory<T>
impl<T> !Sync for RawMemory<T>
impl<T> Freeze for RawMemory<T>
impl<T> RefUnwindSafe for RawMemory<T>where
T: RefUnwindSafe,
impl<T> Unpin for RawMemory<T>
impl<T> UnsafeUnpin for RawMemory<T>
impl<T> UnwindSafe for RawMemory<T>where
T: RefUnwindSafe,
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