dyn_stack

Struct StackReq

Source
pub struct StackReq { /* private fields */ }
Expand description

Stack allocation requirements.

Implementations§

Source§

impl StackReq

Source

pub const EMPTY: Self

Allocation requirements for an empty unaligned buffer.

Source

pub const OVERFLOW: Self

Unsatisfiable allocation requirements.

Source

pub const fn empty() -> StackReq

Allocation requirements for an empty unaligned buffer.

Source

pub const fn new_aligned<T>(n: usize, align: usize) -> StackReq

Allocation requirements sufficient for n elements of type T, overaligned with alignment align.

§Errors
  • if align is smaller than the minimum required alignment for an object of type T.
  • if align is not a power of two.
  • if the size computation overflows
Source

pub const fn new<T>(n: usize) -> StackReq

Allocation requirements sufficient for n elements of type T.

§Errors
  • if the size computation overflows
Source

pub const fn size_bytes(&self) -> usize

The number of allocated bytes required, aligned to self.align_bytes().

Source

pub const fn align_bytes(&self) -> usize

The alignment of allocated bytes required, or 0 if the size overflowed.

Source

pub const fn unaligned_bytes_required(&self) -> usize

The number of allocated bytes required, with no alignment constraints, or usize::MAX in the case of overflow.

§Panics
  • if the size computation overflowed
Source

pub const fn layout(self) -> Result<Layout, LayoutError>

Returns the corresponding layout for the allocation size and alignment.

Source

pub const fn and(self, other: StackReq) -> StackReq

The required allocation to allocate storage sufficient for both of self and other, simultaneously and in any order.

§Panics
  • if the allocation requirement computation overflows.
Source

pub const fn all_of(reqs: &[Self]) -> Self

The required allocation to allocate storage sufficient for all the requirements produced by the given iterator, simultaneously and in any order.

§Panics
  • if the allocation requirement computation overflows.
Source

pub const fn or(self, other: StackReq) -> StackReq

The required allocation to allocate storage sufficient for either of self and other, with only one being active at a time.

§Panics
  • if the allocation requirement computation overflows.
Source

pub fn any_of(reqs: &[StackReq]) -> StackReq

The required allocation to allocate storage sufficient for any of the requirements produced by the given iterator, with at most one being active at a time.

§Panics
  • if the allocation requirement computation overflows.
Source

pub const fn array(self, n: usize) -> StackReq

Same as StackReq::and repeated n times.

Trait Implementations§

Source§

impl Clone for StackReq

Source§

fn clone(&self) -> StackReq

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StackReq

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StackReq

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for StackReq

Source§

fn eq(&self, other: &StackReq) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for StackReq

Source§

impl Eq for StackReq

Source§

impl StructuralPartialEq for StackReq

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.