Struct extendr_api::prelude::utils::constrained::Array

#[repr(transparent)]
pub struct Array<'n, T>(Branded<'n, [T]>);
Expand description

Array of length equal to the value tied to 'n.

Tuple Fields§

§0: Branded<'n, [T]>

Implementations§

§

impl<'n, T> Array<'n, T>

pub fn from_ref<'a>(slice: &'a [T], size: Size<'n>) -> &'a Array<'n, T>

Returns a constrained array after checking that its length matches size.

pub fn from_mut<'a>(slice: &'a mut [T], size: Size<'n>) -> &'a mut Array<'n, T>

Returns a constrained array after checking that its length matches size.

pub fn as_ref(&self) -> &[T]

Returns the unconstrained slice.

pub fn as_mut<'a>(&mut self) -> &'a mut [T]

Returns the unconstrained slice.

pub fn len(&self) -> Size<'n>

Returns the length of self.

Trait Implementations§

§

impl<T> Debug for Array<'_, T>
where T: Debug,

§

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

Formats the value using the given formatter. Read more
§

impl<'n, T> Index<Idx<'n, usize>> for Array<'n, T>

§

type Output = T

The returned type after indexing.
§

fn index( &self, idx: Idx<'n, usize>, ) -> &<Array<'n, T> as Index<Idx<'n, usize>>>::Output

Performs the indexing (container[index]) operation. Read more
§

impl<'n, T> Index<Range<IdxInclusive<'n, usize>>> for Array<'n, T>

§

type Output = [T]

The returned type after indexing.
§

fn index( &self, idx: Range<IdxInclusive<'n, usize>>, ) -> &<Array<'n, T> as Index<Range<IdxInclusive<'n, usize>>>>::Output

Performs the indexing (container[index]) operation. Read more
§

impl<'n, T> IndexMut<Idx<'n, usize>> for Array<'n, T>

§

fn index_mut( &mut self, idx: Idx<'n, usize>, ) -> &mut <Array<'n, T> as Index<Idx<'n, usize>>>::Output

Performs the mutable indexing (container[index]) operation. Read more
§

impl<'n, T> IndexMut<Range<IdxInclusive<'n, usize>>> for Array<'n, T>

§

fn index_mut( &mut self, idx: Range<IdxInclusive<'n, usize>>, ) -> &mut <Array<'n, T> as Index<Range<IdxInclusive<'n, usize>>>>::Output

Performs the mutable indexing (container[index]) operation. Read more
§

impl<'n, T> Ord for Array<'n, T>
where T: Ord,

§

fn cmp(&self, other: &Array<'n, T>) -> Ordering

This method returns an Ordering between self and other. Read more
§

impl<'n, T> PartialEq for Array<'n, T>
where T: PartialEq,

§

fn eq(&self, other: &Array<'n, T>) -> 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<'n, T> PartialOrd for Array<'n, T>
where T: PartialOrd,

§

fn partial_cmp(&self, other: &Array<'n, T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl<'n, T> Eq for Array<'n, T>
where T: Eq,

§

impl<'n, T> StructuralPartialEq for Array<'n, T>

Auto Trait Implementations§

§

impl<'n, T> Freeze for Array<'n, T>
where T: Freeze,

§

impl<'n, T> RefUnwindSafe for Array<'n, T>
where T: RefUnwindSafe,

§

impl<'n, T> Send for Array<'n, T>
where T: Send,

§

impl<'n, T> !Sized for Array<'n, T>

§

impl<'n, T> Sync for Array<'n, T>
where T: Sync,

§

impl<'n, T> Unpin for Array<'n, T>
where T: Unpin,

§

impl<'n, T> UnwindSafe for Array<'n, T>
where T: UnwindSafe,

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