Union coca::object::InlineStorage
source · [−]#[repr(C)]
pub union InlineStorage<A, const N: usize> {
/* private fields */
}
This is supported on crate feature
unstable
only.Expand description
An N
-wide, partially initialized byte array with the alignment of A
.
Examples
Note that its size in memory is always a multiple of its alignment, so it
is recommended to chose N
accordingly:
use core::mem::{align_of, size_of};
use coca::object::{InlineStorage, Align16};
assert_eq!(align_of::<InlineStorage<Align16, 10>>(), 16);
assert_eq!(size_of::<InlineStorage<Align16, 10>>(), 16);
assert_eq!(size_of::<InlineStorage<Align16, 16>>(), 16);
assert_eq!(size_of::<InlineStorage<Align16, 20>>(), 32);
Trait Implementations
sourceimpl<A, const N: usize> Storage<ObjectLayout> for InlineStorage<A, N>
impl<A, const N: usize> Storage<ObjectLayout> for InlineStorage<A, N>
sourcefn capacity(&self) -> usize
fn capacity(&self) -> usize
Returns the maximum number of items the memory block can hold. Read more
sourcefn get_ptr(&self) -> *const u8
fn get_ptr(&self) -> *const u8
Extracts a pointer to the beginning of the memory block. Read more
sourcefn get_mut_ptr(&mut self) -> *mut u8
fn get_mut_ptr(&mut self) -> *mut u8
Extracts a mutable pointer to the beginning of the memory block. Read more
Auto Trait Implementations
impl<A, const N: usize> RefUnwindSafe for InlineStorage<A, N> where
A: RefUnwindSafe,
impl<A, const N: usize> Send for InlineStorage<A, N> where
A: Send,
impl<A, const N: usize> Sync for InlineStorage<A, N> where
A: Sync,
impl<A, const N: usize> Unpin for InlineStorage<A, N> where
A: Unpin,
impl<A, const N: usize> UnwindSafe for InlineStorage<A, N> where
A: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more