Struct dyn_stack::StackReq

source ·
pub struct StackReq { /* private fields */ }
Expand description

Stack allocation requirements.

Implementations§

source§

impl StackReq

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.

§Panics
  • 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.

§Panics
  • if the size computation overflows
source

pub const fn try_new_aligned<T>( n: usize, align: usize ) -> Result<StackReq, SizeOverflow>

Same as StackReq::new_aligned, but returns an error in case the size computation overflows.

§Panics
  • if align is smaller than the minimum required alignment for an object of type T.
  • if align is not a power of two.
source

pub const fn try_new<T>(n: usize) -> Result<StackReq, SizeOverflow>

Same as StackReq::new, but returns an error in case 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.

source

pub const fn unaligned_bytes_required(&self) -> usize

The number of allocated bytes required, with no alignment constraints.

§Panics
  • if the size computation overflows
source

pub const fn try_unaligned_bytes_required(&self) -> Result<usize, SizeOverflow>

Same as StackReq::unaligned_bytes_required, but returns an error if the size computation overflows.

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 fn all_of(reqs: impl IntoIterator<Item = StackReq>) -> StackReq

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: impl IntoIterator<Item = 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 try_and(self, other: StackReq) -> Result<StackReq, SizeOverflow>

Same as StackReq::and, but returns an error if the size computation overflows.

source

pub fn try_all_of( reqs: impl IntoIterator<Item = StackReq> ) -> Result<StackReq, SizeOverflow>

Same as StackReq::all_of, but returns an error if the size computation overflows.

source

pub const fn try_or(self, other: StackReq) -> Result<StackReq, SizeOverflow>

Same as StackReq::or, but returns an error if the size computation overflows.

source

pub fn try_any_of( reqs: impl IntoIterator<Item = StackReq> ) -> Result<StackReq, SizeOverflow>

Same as StackReq::any_of, but returns an error if the size computation overflows.

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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> 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,

§

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>,

§

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>,

§

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.