Skip to main content

ConstInclusiveRange

Struct ConstInclusiveRange 

Source
pub struct ConstInclusiveRange<const MIN: i128, const MAX: i128>
where
    Assert<{ _ }>: IsAllowed;
Expand description

Const inclusive range for iterators with Ranged output and array indexing

Do not use directly, use r! macro instead

§Example

let mut fibonacci = [0; 10];
fibonacci[0] = 1;
fibonacci[1] = 1;
for i in r!(2..=9) {
    fibonacci[i.expand()] = fibonacci[(i-r!(1)).expand()] + fibonacci[(i-r!(2)).expand()];
}

let fib2345: [_; 4] = fibonacci[r!(2..=5)];
assert_eq!(fib2345, [2,3,5,8]);

Trait Implementations§

Source§

impl<const MIN: i128, const MAX: i128> Clone for ConstInclusiveRange<MIN, MAX>
where Assert<{ _ }>: IsAllowed,

Source§

fn clone(&self) -> ConstInclusiveRange<MIN, MAX>

Returns a duplicate 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<T, const N: usize, const MIN: i128, const MAX: i128> Index<ConstInclusiveRange<MIN, MAX>> for [T; N]
where Assert<{ _ }>: IsAllowed, [T; { _ }]:, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

type Output = [T; { _ }]

The returned type after indexing.
Source§

fn index(&self, _index: ConstInclusiveRange<MIN, MAX>) -> &Self::Output

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

impl<T, const N: usize, const MIN: i128, const MAX: i128> IndexMut<ConstInclusiveRange<MIN, MAX>> for [T; N]
where Assert<{ _ }>: IsAllowed, [T; { _ }]:, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

fn index_mut( &mut self, _index: ConstInclusiveRange<MIN, MAX>, ) -> &mut Self::Output

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

impl<const MIN: i128, const MAX: i128> IntoIterator for ConstInclusiveRange<MIN, MAX>
where Assert<{ _ }>: IsAllowed,

Source§

type Item = Ranged<MIN, MAX>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<MIN, MAX>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<const MIN: i128, const MAX: i128> Copy for ConstInclusiveRange<MIN, MAX>
where Assert<{ _ }>: IsAllowed,

Auto Trait Implementations§

§

impl<const MIN: i128, const MAX: i128> Freeze for ConstInclusiveRange<MIN, MAX>

§

impl<const MIN: i128, const MAX: i128> RefUnwindSafe for ConstInclusiveRange<MIN, MAX>

§

impl<const MIN: i128, const MAX: i128> Send for ConstInclusiveRange<MIN, MAX>

§

impl<const MIN: i128, const MAX: i128> Sync for ConstInclusiveRange<MIN, MAX>

§

impl<const MIN: i128, const MAX: i128> Unpin for ConstInclusiveRange<MIN, MAX>

§

impl<const MIN: i128, const MAX: i128> UnwindSafe for ConstInclusiveRange<MIN, MAX>

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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, 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.