Skip to main content

ListIndex

Trait ListIndex 

pub trait ListIndex<Idx>
where Idx: ?Sized,
{ type Output; // Required method fn index(&self, index: Idx) -> &Self::Output; }
Expand description

Indexing for lists using typenum-based indices and ranges.

The index type establishes that the selected field or range exists.

§Examples

use cel_runtime::{IntoTupleList, ListIndex};
let list = ("first", 7u8).into_tuple_list();
assert_eq!(*list.index(typenum::U1::new()), 7);

Required Associated Types§

type Output

The output reference type when indexing with Idx.

Required Methods§

fn index(&self, index: Idx) -> &Self::Output

Borrows the element or sublist selected by index.

  • Complexity: Representation-dependent; recursive suffix traversal takes O(i) steps for source index i.
§Examples

See ListIndex.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

§

impl ListIndex<RangeFrom<UTerm>> for ()

§

fn index( &self, _index: RangeFrom<UTerm>, ) -> &<() as ListIndex<RangeFrom<UTerm>>>::Output

Borrows the empty suffix at the only valid empty-list boundary.

§

type Output = ()

§

impl<H, T, U, B> ListIndex<RangeFrom<UInt<U, B>>> for (H, T)
where H: 'static, T: List + ListIndex<RangeFrom<<UInt<U, B> as Sub<B1>>::Output>>, U: Unsigned, B: Bit, UInt<U, B>: Sub<B1>,

§

fn index( &self, index: RangeFrom<UInt<U, B>>, ) -> &<(H, T) as ListIndex<RangeFrom<UInt<U, B>>>>::Output

Borrows the suffix at the type-checked source index.

  • Complexity: O(i) tail traversals for source index i.
§

type Output = <T as ListIndex<RangeFrom<<UInt<U, B> as Sub<B1>>::Output>>>::Output

§

impl<H, T, U, B> ListIndex<UInt<U, B>> for (H, T)
where H: 'static, T: List + ListIndex<<UInt<U, B> as Sub<B1>>::Output>, U: Unsigned, B: Bit, UInt<U, B>: Sub<B1>,

§

fn index(&self, index: UInt<U, B>) -> &<(H, T) as ListIndex<UInt<U, B>>>::Output

Borrows the field at the type-checked source index.

  • Complexity: O(i) tail traversals for source index i.
§

type Output = <T as ListIndex<<UInt<U, B> as Sub<B1>>::Output>>::Output

§

impl<H, T> ListIndex<RangeFrom<UTerm>> for (H, T)
where H: 'static, T: List,

§

fn index( &self, _index: RangeFrom<UTerm>, ) -> &<(H, T) as ListIndex<RangeFrom<UTerm>>>::Output

Borrows the complete suffix starting at zero.

§

type Output = (H, T)

§

impl<H, T> ListIndex<UTerm> for (H, T)
where H: 'static, T: List,

§

fn index(&self, _index: UTerm) -> &<(H, T) as ListIndex<UTerm>>::Output

Borrows the first source field.

§

type Output = H

Implementors§

§

impl<H, T, U, B> ListIndex<RangeFrom<UInt<U, B>>> for CStackList<H, T>
where H: 'static, T: List + CStackListHeadLimit + ListIndex<RangeFrom<<UInt<U, B> as Sub<B1>>::Output>>, U: Unsigned, B: Bit, UInt<U, B>: Sub<B1>,

§

type Output = <T as ListIndex<RangeFrom<<UInt<U, B> as Sub<B1>>::Output>>>::Output

§

impl<H, T, U, B> ListIndex<RangeTo<UInt<U, B>>> for CStackList<H, T>
where H: 'static, T: List + CStackListHeadLimit + ListIndex<RangeTo<<UInt<U, B> as Sub<B1>>::Output>>, U: Unsigned, B: Bit, <T as ListIndex<RangeTo<<UInt<U, B> as Sub<B1>>::Output>>>::Output: List, UInt<U, B>: Sub<B1>,

§

type Output = <<T as ListIndex<RangeTo<<UInt<U, B> as Sub<B1>>::Output>>>::Output as List>::Push<H>

§

impl<H, T, U, B> ListIndex<RangeToInclusive<UInt<U, B>>> for CStackList<H, T>
where H: 'static, T: List + CStackListHeadLimit + ListIndex<RangeToInclusive<<UInt<U, B> as Sub<B1>>::Output>>, U: Unsigned, B: Bit, <T as ListIndex<RangeToInclusive<<UInt<U, B> as Sub<B1>>::Output>>>::Output: List, UInt<U, B>: Sub<B1>,

§

type Output = <<T as ListIndex<RangeToInclusive<<UInt<U, B> as Sub<B1>>::Output>>>::Output as List>::Push<H>

§

impl<H, T, U, B> ListIndex<UInt<U, B>> for CStackList<H, T>
where H: 'static, T: List + CStackListHeadLimit + ListIndex<<UInt<U, B> as Sub<B1>>::Output>, U: Unsigned, B: Bit, UInt<U, B>: Sub<B1>,

§

type Output = <T as ListIndex<<UInt<U, B> as Sub<B1>>::Output>>::Output

§

impl<H, T> ListIndex<RangeFrom<UTerm>> for CStackList<H, T>
where H: 'static, T: List + CStackListHeadLimit,

§

type Output = CStackList<H, T>

§

impl<H, T> ListIndex<RangeTo<UTerm>> for CStackList<H, T>
where H: 'static, T: List + CStackListHeadLimit,

§

type Output = CNil<CStackList<H, T>>

§

impl<H, T> ListIndex<RangeToInclusive<UTerm>> for CStackList<H, T>
where H: 'static, T: List + CStackListHeadLimit,

§

type Output = CStackList<H, CNil<T>>

§

impl<H, T> ListIndex<UTerm> for CStackList<H, T>
where H: 'static, T: List + CStackListHeadLimit,

§

type Output = H