dyn_stack

Struct UnpodStack

Source
pub struct UnpodStack<'a> { /* private fields */ }
Expand description

Owns an unsized array of data, allocated from some stack.

Methods from Deref<Target = MemStack>§

Source

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.

Source

pub fn len_bytes(&self) -> usize

Returns the number of bytes that this stack can hold.

Source

pub fn as_ptr(&self) -> *const u8

Returns a pointer to the (possibly uninitialized) stack memory.

Source

pub fn make_aligned_uninit<T>( &mut self, size: usize, align: usize, ) -> (&mut [MaybeUninit<T>], &mut Self)

Returns a new aligned and uninitialized DynArray and a stack over the remainder of the buffer.

§Panics

Panics if the stack isn’t large enough to allocate the array.

Source

pub fn make_aligned_with<T>( &mut self, size: usize, align: usize, f: impl FnMut(usize) -> T, ) -> (DynArray<'_, T>, &mut Self)

Returns a new aligned DynArray, initialized with the provided function, and a stack over the remainder of the buffer.

§Panics

Panics if the stack isn’t large enough to allocate the array, or if the provided function panics.

Source

pub fn make_uninit<T>( &mut self, size: usize, ) -> (&mut [MaybeUninit<T>], &mut Self)

Returns a new uninitialized DynArray and a stack over the remainder of the buffer.

§Panics

Panics if the stack isn’t large enough to allocate the array.

Source

pub fn make_with<T>( &mut self, size: usize, f: impl FnMut(usize) -> T, ) -> (DynArray<'_, T>, &mut Self)

Returns a new DynArray, initialized with the provided function, and a stack over the remainder of the buffer.

§Panics

Panics if the stack isn’t large enough to allocate the array, or if the provided function panics.

Source

pub fn collect_aligned<I>( &mut self, align: usize, iter: impl IntoIterator<Item = I>, ) -> (DynArray<'_, I>, &mut Self)

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.

Source

pub fn collect<I>( &mut self, iter: impl IntoIterator<Item = I>, ) -> (DynArray<'_, I>, &mut Self)

Returns a new 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.

Source

pub fn bump<'bump, 'stack>( self: &'bump mut &'stack mut Self, ) -> &'bump mut Bump<'stack>

Trait Implementations§

Source§

impl Deref for UnpodStack<'_>

Source§

type Target = MemStack

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for UnpodStack<'_>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl Drop for UnpodStack<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for UnpodStack<'_>

Source§

impl Sync for UnpodStack<'_>

Auto Trait Implementations§

§

impl<'a> Freeze for UnpodStack<'a>

§

impl<'a> RefUnwindSafe for UnpodStack<'a>

§

impl<'a> Unpin for UnpodStack<'a>

§

impl<'a> UnwindSafe for UnpodStack<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.