Skip to main content

Get

Trait Get 

Source
pub trait Get<Idx>: Collection {
    type Output: ?Sized;

    // Required method
    fn get(&self, index: Idx) -> Option<&Self::Output>;

    // Provided methods
    fn get_or_panic(&self, index: Idx) -> &Self::Output { ... }
    unsafe fn get_unchecked(&self, index: Idx) -> &Self::Output { ... }
    fn is_index_valid(&self, index: Idx) -> bool { ... }
    fn is_index_invalid(&self, index: Idx) -> bool { ... }
    fn contains(&self, index: Idx) -> bool { ... }
}
Expand description

The collection have a quick way to access each element, where the index is copyable

Required Associated Types§

Required Methods§

Source

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

Returns a reference to the value.

Provided Methods§

Source

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

Returns a reference to the value.

Source

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

Returns a reference to the value.

Source

fn is_index_valid(&self, index: Idx) -> bool

True if get(index) return Some, false otherwise.

Source

fn is_index_invalid(&self, index: Idx) -> bool

True if get(index) return None, false otherwise.

Source

fn contains(&self, index: Idx) -> bool

Implementations on Foreign Types§

Source§

impl<Idx> Get<Idx> for &str
where Idx: SliceIndex<str>,

Source§

type Output = <str as Index<Idx>>::Output

Source§

fn get(&self, index: Idx) -> Option<&<&str as Get<Idx>>::Output>

Source§

unsafe fn get_unchecked(&self, index: Idx) -> &<&str as Get<Idx>>::Output

Source§

impl<Idx> Get<Idx> for &mut str
where Idx: SliceIndex<str>,

Source§

type Output = <str as Index<Idx>>::Output

Source§

fn get(&self, index: Idx) -> Option<&<&mut str as Get<Idx>>::Output>

Source§

unsafe fn get_unchecked(&self, index: Idx) -> &<&mut str as Get<Idx>>::Output

Source§

impl<Idx> Get<Idx> for str
where Idx: SliceIndex<str>,

Source§

type Output = <str as Index<Idx>>::Output

Source§

fn get(&self, index: Idx) -> Option<&<str as Get<Idx>>::Output>

Source§

unsafe fn get_unchecked(&self, index: Idx) -> &<str as Get<Idx>>::Output

Source§

impl<Idx> Get<Idx> for String
where Idx: SliceIndex<str>,

Source§

type Output = <str as Get<Idx>>::Output

Source§

fn get(&self, index: Idx) -> Option<&<String as Get<Idx>>::Output>

Source§

unsafe fn get_unchecked(&self, index: Idx) -> &<String as Get<Idx>>::Output

Source§

impl<Idx, T> Get<Idx> for &[T]
where Idx: SliceIndex<[T]>,

Source§

type Output = <[T] as Index<Idx>>::Output

Source§

fn get(&self, index: Idx) -> Option<&<&[T] as Get<Idx>>::Output>

Source§

unsafe fn get_unchecked(&self, index: Idx) -> &<&[T] as Get<Idx>>::Output

Source§

impl<Idx, T> Get<Idx> for &mut [T]
where Idx: SliceIndex<[T]>,

Source§

type Output = <[T] as Index<Idx>>::Output

Source§

fn get(&self, index: Idx) -> Option<&<&mut [T] as Get<Idx>>::Output>

Source§

unsafe fn get_unchecked(&self, index: Idx) -> &<&mut [T] as Get<Idx>>::Output

Source§

impl<Idx, T> Get<Idx> for [T]
where Idx: SliceIndex<[T]>,

Source§

type Output = <[T] as Index<Idx>>::Output

Source§

fn get(&self, index: Idx) -> Option<&<[T] as Get<Idx>>::Output>

Source§

unsafe fn get_unchecked(&self, index: Idx) -> &<[T] as Get<Idx>>::Output

Source§

impl<Idx, T> Get<Idx> for Vec<T>
where [T]: Get<Idx>,

Source§

type Output = <[T] as Get<Idx>>::Output

Source§

fn get(&self, index: Idx) -> Option<&<Vec<T> as Get<Idx>>::Output>

Source§

unsafe fn get_unchecked(&self, index: Idx) -> &<Vec<T> as Get<Idx>>::Output

Source§

impl<Idx, T, const CAP: usize> Get<Idx> for ArrayVec<T, CAP>
where [T]: Get<Idx>,

Source§

type Output = <[T] as Get<Idx>>::Output

Source§

fn get(&self, index: Idx) -> Option<&<ArrayVec<T, CAP> as Get<Idx>>::Output>

Source§

unsafe fn get_unchecked( &self, index: Idx, ) -> &<ArrayVec<T, CAP> as Get<Idx>>::Output

Source§

impl<Idx, T, const N: usize> Get<Idx> for [T; N]
where [T]: Get<Idx>,

Source§

type Output = <[T] as Get<Idx>>::Output

Source§

fn get(&self, index: Idx) -> Option<&<[T; N] as Get<Idx>>::Output>

Source§

unsafe fn get_unchecked(&self, index: Idx) -> &<[T; N] as Get<Idx>>::Output

Implementors§

Source§

impl<'a, P, G, T, Idx, const N: usize> Get<P> for GridView<'a, G, T, Idx, N>
where G: IGrid<T, Idx, N>, Idx: Integer, P: Into<Vector<Idx, N>>,

Source§

type Output = <G as Get<Vector<Idx, N>>>::Output

Source§

impl<'a, P, G, T, Idx, const N: usize> Get<P> for GridViewMut<'a, G, T, Idx, N>
where G: IGrid<T, Idx, N>, Idx: Integer, P: Into<Vector<Idx, N>>,

Source§

type Output = <G as Get<Vector<Idx, N>>>::Output

Source§

impl<'a, Q, K, Gen, S> Get<&'a Q> for GenSetOf<K, Gen, S>
where K: Clone + Borrow<Q>, Gen: IGeneration, S: Get<&'a Q, Output = GenIDOf<K, Gen>>, Q: ?Sized,

Source§

impl<'a, Q, K, V, Gen, S> Get<&'a Q> for GenMapOf<K, V, Gen, S>
where K: Clone + Borrow<Q>, Gen: IGeneration, S: Get<&'a Q, Output = GenIDOf<V, Gen>>, Q: ?Sized,

Source§

impl<K, Gen, S> Get<GenIDOf<K, Gen>> for GenSetOf<K, Gen, S>
where K: Clone, Gen: IGeneration, S: Collection,

Source§

impl<K, Gen, S> Get<UntypedGenIDOf<Gen>> for GenSetOf<K, Gen, S>
where K: Clone, Gen: IGeneration, S: Collection,

Source§

impl<K, Q> Get<&Q> for BTreeSet<K>
where K: Borrow<Q> + Ord, Q: Ord + ?Sized,

Source§

impl<K, S, Q> Get<&Q> for HashSet<K, S>
where K: Borrow<Q> + Eq + Hash, Q: Hash + Eq + ?Sized, S: BuildHasher,

Available on crate feature std only.
Source§

impl<K, V, Gen, S> Get<GenIDOf<V, Gen>> for GenMapOf<K, V, Gen, S>
where K: Clone, Gen: IGeneration, S: Collection,

Source§

impl<K, V, Gen, S> Get<UntypedGenIDOf<Gen>> for GenMapOf<K, V, Gen, S>
where K: Clone, Gen: IGeneration, S: Collection,

Source§

impl<K, V, Q> Get<&Q> for BTreeMap<K, V>
where K: Borrow<Q> + Ord, Q: Ord + ?Sized,

Source§

impl<K, V, S, Q> Get<&Q> for HashMap<K, V, S>
where K: Borrow<Q> + Eq + Hash, Q: Hash + Eq + ?Sized, S: BuildHasher,

Available on crate feature std only.
Source§

impl<P, T, Idx> Get<P> for ImageBaseOf<T, Idx>
where Idx: Integer, P: Into<Vector<Idx, 2>>,

Source§

impl<P, T, Idx, const N: usize> Get<P> for GridOf<T, Idx, N>
where Idx: Integer, P: Into<Vector<Idx, N>>,

Source§

type Output = <GridOf<T, Idx, N> as Index<Vector<Idx, N>>>::Output

Source§

impl<T> Get<usize> for NonEmptyStack<T>

Source§

impl<T> Get<usize> for VecDeque<T>

Source§

impl<T, Gen, C> Get<usize> for GenSeq<T, Gen, C>
where C: AsRef<[Entry<T, Gen>]>, Gen: IGeneration,

Source§

type Output = <GenSeq<T, Gen, C> as Index<usize>>::Output

Source§

impl<T, Gen, C> Get<GenIDOf<T, Gen>> for GenSeq<T, Gen, C>
where C: AsRef<[Entry<T, Gen>]>, Gen: IGeneration,

Source§

type Output = <GenSeq<T, Gen, C> as Index<GenIDOf<T, Gen>>>::Output

Source§

impl<T, Gen, C> Get<UntypedGenIDOf<Gen>> for GenSeq<T, Gen, C>
where C: AsRef<[Entry<T, Gen>]>, Gen: IGeneration,

Source§

type Output = <GenSeq<T, Gen, C> as Index<GenIDOf<T, Gen>>>::Output

Source§

impl<T, Idx> Get<Idx> for HslaOf<T>
where [T; 4]: Get<Idx>,

Source§

type Output = <[T; 4] as Get<Idx>>::Output

Source§

impl<T, Idx> Get<Idx> for RgbaOf<T>
where [T; 4]: Get<Idx>,

Source§

type Output = <[T; 4] as Get<Idx>>::Output

Source§

impl<T, Idx> Get<Idx> for RectangleOf<T>
where [T; 2]: Get<Idx>,

Source§

type Output = <[T; 2] as Get<Idx>>::Output

Source§

impl<T, const N: usize, Idx> Get<Idx> for Vector<T, N>
where [T; N]: Get<Idx>,

Source§

type Output = <[T; N] as Get<Idx>>::Output