pub struct MemStack { /* private fields */ }Expand description
Stack wrapper around a buffer of uninitialized bytes.
Implementations§
Source§impl MemStack
impl MemStack
Sourcepub fn new(buffer: &mut [MaybeUninit<u8>]) -> &mut MemStack
pub fn new(buffer: &mut [MaybeUninit<u8>]) -> &mut MemStack
Returns a new MemStack from the provided memory buffer.
Sourcepub fn new_any<T>(buffer: &mut [MaybeUninit<T>]) -> &mut MemStack
pub fn new_any<T>(buffer: &mut [MaybeUninit<T>]) -> &mut MemStack
Returns a new MemStack from the provided memory buffer.
Sourcepub fn can_hold(&self, alloc_req: StackReq) -> bool
pub fn can_hold(&self, alloc_req: StackReq) -> bool
Returns true if the stack can hold an allocation with the given size and alignment
requirements.
Sourcepub fn as_ptr(&self) -> *const u8
pub fn as_ptr(&self) -> *const u8
Returns a pointer to the (possibly uninitialized) stack memory.
Sourcepub fn make_aligned_uninit<T>(
&mut self,
size: usize,
align: usize,
) -> (&mut [MaybeUninit<T>], &mut MemStack)
pub fn make_aligned_uninit<T>( &mut self, size: usize, align: usize, ) -> (&mut [MaybeUninit<T>], &mut MemStack)
Sourcepub fn make_aligned_with<T>(
&mut self,
size: usize,
align: usize,
f: impl FnMut(usize) -> T,
) -> (DynArray<'_, T>, &mut MemStack)
pub fn make_aligned_with<T>( &mut self, size: usize, align: usize, f: impl FnMut(usize) -> T, ) -> (DynArray<'_, T>, &mut MemStack)
Sourcepub fn make_uninit<T>(
&mut self,
size: usize,
) -> (&mut [MaybeUninit<T>], &mut MemStack)
pub fn make_uninit<T>( &mut self, size: usize, ) -> (&mut [MaybeUninit<T>], &mut MemStack)
Sourcepub fn make_with<T>(
&mut self,
size: usize,
f: impl FnMut(usize) -> T,
) -> (DynArray<'_, T>, &mut MemStack)
pub fn make_with<T>( &mut self, size: usize, f: impl FnMut(usize) -> T, ) -> (DynArray<'_, T>, &mut MemStack)
Sourcepub fn collect_aligned<I>(
&mut self,
align: usize,
iter: impl IntoIterator<Item = I>,
) -> (DynArray<'_, I>, &mut MemStack)
pub fn collect_aligned<I>( &mut self, align: usize, iter: impl IntoIterator<Item = I>, ) -> (DynArray<'_, I>, &mut MemStack)
Returns a new aligned DynArray, initialized with the provided iterator, and a stack
over the remainder of the buffer.
If there isn’t enough space for all the iterator items, then the returned array only
contains the first elements that fit into the stack.
§Panics
Panics if the provided iterator panics.
Sourcepub fn collect<I>(
&mut self,
iter: impl IntoIterator<Item = I>,
) -> (DynArray<'_, I>, &mut MemStack)
pub fn collect<I>( &mut self, iter: impl IntoIterator<Item = I>, ) -> (DynArray<'_, I>, &mut MemStack)
pub fn bump<'bump, 'stack>( self: &'bump mut &'stack mut MemStack, ) -> &'bump mut Bump<'stack>
Auto Trait Implementations§
impl !Sized for MemStack
impl Freeze for MemStack
impl RefUnwindSafe for MemStack
impl Send for MemStack
impl Sync for MemStack
impl Unpin for MemStack
impl UnsafeUnpin for MemStack
impl UnwindSafe for MemStack
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
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
Source§impl<T> SelfOps for Twhere
T: ?Sized,
impl<T> SelfOps for Twhere
T: ?Sized,
Source§fn piped<F, U>(self, f: F) -> U
fn piped<F, U>(self, f: F) -> U
Emulates the pipeline operator, allowing method syntax in more places. Read more
Source§fn piped_ref<'a, F, U>(&'a self, f: F) -> Uwhere
F: FnOnce(&'a Self) -> U,
fn piped_ref<'a, F, U>(&'a self, f: F) -> Uwhere
F: FnOnce(&'a Self) -> U,
The same as
piped except that the function takes &Self
Useful for functions that take &Self instead of Self. Read moreSource§fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
The same as
piped, except that the function takes &mut Self.
Useful for functions that take &mut Self instead of Self.Source§fn mutated<F>(self, f: F) -> Self
fn mutated<F>(self, f: F) -> Self
Mutates self using a closure taking self by mutable reference,
passing it along the method chain. Read more
Source§fn observe<F>(self, f: F) -> Self
fn observe<F>(self, f: F) -> Self
Observes the value of self, passing it along unmodified.
Useful in long method chains. Read more
Source§fn as_ref_<T>(&self) -> &T
fn as_ref_<T>(&self) -> &T
Performs a reference to reference conversion with
AsRef,
using the turbofish .as_ref_::<_>() syntax. Read moreSource§impl<This> TransmuteElement for Thiswhere
This: ?Sized,
impl<This> TransmuteElement for Thiswhere
This: ?Sized,
Source§unsafe fn transmute_element<T>(self) -> Self::TransmutedPtrwhere
Self: CanTransmuteElement<T>,
unsafe fn transmute_element<T>(self) -> Self::TransmutedPtrwhere
Self: CanTransmuteElement<T>,
Transmutes the element type of this pointer.. Read more
Source§impl<T> TypeIdentity for Twhere
T: ?Sized,
impl<T> TypeIdentity for Twhere
T: ?Sized,
Source§fn as_type_mut(&mut self) -> &mut Self::Type
fn as_type_mut(&mut self) -> &mut Self::Type
Converts a mutable reference back to the original type.
Source§fn into_type_box(self: Box<Self>) -> Box<Self::Type>
fn into_type_box(self: Box<Self>) -> Box<Self::Type>
Converts a box back to the original type.
Source§fn into_type_arc(this: Arc<Self>) -> Arc<Self::Type> ⓘ
fn into_type_arc(this: Arc<Self>) -> Arc<Self::Type> ⓘ
Converts an Arc back to the original type. Read more
Source§fn into_type_rc(this: Rc<Self>) -> Rc<Self::Type>
fn into_type_rc(this: Rc<Self>) -> Rc<Self::Type>
Converts an Rc back to the original type. Read more
Source§fn from_type_ref(this: &Self::Type) -> &Self
fn from_type_ref(this: &Self::Type) -> &Self
Converts a reference back to the original type.
Source§fn from_type_mut(this: &mut Self::Type) -> &mut Self
fn from_type_mut(this: &mut Self::Type) -> &mut Self
Converts a mutable reference back to the original type.
Source§fn from_type_box(this: Box<Self::Type>) -> Box<Self>
fn from_type_box(this: Box<Self::Type>) -> Box<Self>
Converts a box back to the original type.