pub struct StackReq { /* private fields */ }
Expand description
Stack allocation requirements.
Implementations§
source§impl StackReq
impl StackReq
sourcepub const fn new_aligned<T>(n: usize, align: usize) -> StackReq
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 typeT
. - if
align
is not a power of two. - if the size computation overflows
sourcepub const fn new<T>(n: usize) -> StackReq
pub const fn new<T>(n: usize) -> StackReq
Allocation requirements sufficient for n
elements of type T
.
§Panics
- if the size computation overflows
sourcepub const fn try_new_aligned<T>(
n: usize,
align: usize,
) -> Result<StackReq, SizeOverflow>
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 typeT
. - if
align
is not a power of two.
sourcepub const fn try_new<T>(n: usize) -> Result<StackReq, SizeOverflow>
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.
sourcepub const fn size_bytes(&self) -> usize
pub const fn size_bytes(&self) -> usize
The number of allocated bytes required, aligned to self.align_bytes()
.
sourcepub const fn align_bytes(&self) -> usize
pub const fn align_bytes(&self) -> usize
The alignment of allocated bytes required.
sourcepub const fn unaligned_bytes_required(&self) -> usize
pub const fn unaligned_bytes_required(&self) -> usize
The number of allocated bytes required, with no alignment constraints.
§Panics
- if the size computation overflows
sourcepub const fn try_unaligned_bytes_required(&self) -> Result<usize, SizeOverflow>
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.
sourcepub const fn and(self, other: StackReq) -> StackReq
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.
sourcepub fn all_of(reqs: impl IntoIterator<Item = StackReq>) -> StackReq
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.
sourcepub const fn or(self, other: StackReq) -> StackReq
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.
sourcepub fn any_of(reqs: impl IntoIterator<Item = StackReq>) -> StackReq
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.
sourcepub const fn try_and(self, other: StackReq) -> Result<StackReq, SizeOverflow>
pub const fn try_and(self, other: StackReq) -> Result<StackReq, SizeOverflow>
Same as StackReq::and
, but returns an error if the size computation overflows.
sourcepub fn try_all_of(
reqs: impl IntoIterator<Item = StackReq>,
) -> Result<StackReq, SizeOverflow>
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.
sourcepub const fn try_or(self, other: StackReq) -> Result<StackReq, SizeOverflow>
pub const fn try_or(self, other: StackReq) -> Result<StackReq, SizeOverflow>
Same as StackReq::or
, but returns an error if the size computation overflows.
sourcepub fn try_any_of(
reqs: impl IntoIterator<Item = StackReq>,
) -> Result<StackReq, SizeOverflow>
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§
impl Copy for StackReq
impl Eq for StackReq
impl StructuralPartialEq for StackReq
Auto Trait Implementations§
impl Freeze for StackReq
impl RefUnwindSafe for StackReq
impl Send for StackReq
impl Sync for StackReq
impl Unpin for StackReq
impl UnwindSafe for StackReq
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)