extendr_api::prelude::dyn_stack

Struct StackReq

pub struct StackReq {
    align: NonZero<usize>,
    size: usize,
}
Expand description

Stack allocation requirements.

Fields§

§align: NonZero<usize>§size: usize

Implementations§

§

impl StackReq

pub const fn empty() -> StackReq

Allocation requirements for an empty unaligned buffer.

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

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

Allocation requirements sufficient for n elements of type T.

§Panics
  • if the size computation overflows

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.

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.

pub const fn size_bytes(&self) -> usize

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

pub const fn align_bytes(&self) -> usize

The alignment of allocated bytes required.

pub const fn unaligned_bytes_required(&self) -> usize

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

§Panics
  • if the size computation overflows

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.

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.

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.

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.

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.

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

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

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.

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

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

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 Clone for StackReq

§

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
§

impl Debug for StackReq

§

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

Formats the value using the given formatter. Read more
§

impl Default for StackReq

§

fn default() -> StackReq

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

impl PartialEq for StackReq

§

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

impl Copy for StackReq

§

impl Eq for StackReq

§

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 T)

🔬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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
§

impl<T> Boilerplate for T
where T: Copy + Send + Sync + Debug + PartialEq + 'static,