[][src]Trait flatk::GetIndex

pub trait GetIndex<'a, S> where
    S: ?Sized
{ type Output; fn get(self, set: &S) -> Option<Self::Output>; }

A helper trait analogous to SliceIndex from the standard library.

Associated Types

type Output

Loading content...

Required methods

fn get(self, set: &S) -> Option<Self::Output>

Loading content...

Implementations on Foreign Types

impl<'a, O: Get<'a, Range<usize>>> GetIndex<'a, Offsets<O>> for Range<usize>[src]

type Output = Offsets<O::Output>

impl<'a, O: Get<'a, Range<usize>>> GetIndex<'a, SortedChunks<O>> for Range<usize>[src]

type Output = SortedChunks<O::Output>

impl<'a, S, O> GetIndex<'a, Chunked<S, O>> for usize where
    S: Set + View<'a> + Get<'a, Range<usize>, Output = <S as View<'a>>::Type>,
    O: IndexRange
[src]

type Output = S::Output

fn get(self, chunked: &Chunked<S, O>) -> Option<Self::Output>[src]

Get an element of the given Chunked collection.

Example

use flatk::*;
let v = vec![0, 1, 4, 6];
let data = (1..=6).collect::<Vec<_>>();
let s = Chunked::from_offsets(v.as_slice(), data.view());
assert_eq!(Some(&[1][..]), s.get(0));
assert_eq!(Some(&[2,3,4][..]), s.get(1));
assert_eq!(Some(&[5,6][..]), s.get(2));

impl<'a, S, O> GetIndex<'a, Chunked<S, O>> for Range<usize> where
    S: Set + View<'a> + Get<'a, Range<usize>, Output = <S as View<'a>>::Type>,
    O: IndexRange + Get<'a, Range<usize>>, 
[src]

type Output = Chunked<S::Output, O::Output>

fn get(self, chunked: &Chunked<S, O>) -> Option<Self::Output>[src]

Get a [begin..end) subview of the given Chunked collection.

Example

use flatk::*;
let data = (1..=6).collect::<Vec<_>>();
let offsets = vec![1, 2, 5, 7]; // Offsets don't have to start at 0
let s = Chunked::from_offsets(offsets.as_slice(), data.view());
let v = s.get(1..3).unwrap();
assert_eq!(Some(&[2,3,4][..]), v.get(0));
assert_eq!(Some(&[5,6][..]), v.get(1));

impl<'a, R> GetIndex<'a, R> for usize where
    R: BoundedRange + Set
[src]

type Output = R::Index

impl<'a, R> GetIndex<'a, R> for Range<usize> where
    R: BoundedRange + Set
[src]

type Output = Range<R::Index>

impl<'a, S, I> GetIndex<'a, Select<S, I>> for usize where
    I: AsRef<[usize]>,
    S: Get<'a, usize>, 
[src]

type Output = (usize, <S as Get<'a, usize>>::Output)

impl<'a, S, T, I> GetIndex<'a, Sparse<S, T, I>> for usize where
    I: AsRef<[usize]>,
    S: Get<'a, usize>, 
[src]

type Output = (usize, <S as Get<'a, usize>>::Output)

impl<'a, S, O> GetIndex<'a, Subset<S, O>> for usize where
    O: AsRef<[usize]>,
    S: Get<'a, usize>, 
[src]

type Output = <S as Get<'a, usize>>::Output

impl<'a, S, T> GetIndex<'a, (S, T)> for usize where
    S: Get<'a, usize>,
    T: Get<'a, usize>, 
[src]

type Output = (S::Output, T::Output)

impl<'a, S, T> GetIndex<'a, (S, T)> for Range<usize> where
    S: Get<'a, Range<usize>>,
    T: Get<'a, Range<usize>>, 
[src]

type Output = (S::Output, T::Output)

impl<'a, S, N> GetIndex<'a, UniChunked<S, U<N>>> for usize where
    S: Set + UniChunkable<N> + Get<'a, StaticRange<N>>,
    N: Unsigned
[src]

type Output = S::Output

fn get(self, chunked: &UniChunked<S, U<N>>) -> Option<Self::Output>[src]

Get an element of the given UniChunked collection.

impl<'a, S, N> GetIndex<'a, UniChunked<S, U<N>>> for Range<usize> where
    S: Set + UniChunkable<N> + Get<'a, Range<usize>>,
    N: Unsigned + Default
[src]

type Output = UniChunked<S::Output, U<N>>

fn get(self, chunked: &UniChunked<S, U<N>>) -> Option<Self::Output>[src]

Get a [begin..end) subview of the given UniChunked collection.

impl<'a, S> GetIndex<'a, UniChunked<S, usize>> for usize where
    S: Set + Get<'a, Range<usize>>, 
[src]

type Output = S::Output

fn get(self, chunked: &ChunkedN<S>) -> Option<Self::Output>[src]

Get an element of the given ChunkedN collection.

impl<'a, S> GetIndex<'a, UniChunked<S, usize>> for Range<usize> where
    S: Set + Get<'a, Range<usize>>, 
[src]

type Output = ChunkedN<S::Output>

fn get(self, chunked: &ChunkedN<S>) -> Option<Self::Output>[src]

Get a [begin..end) subview of the given ChunkedN collection.

impl<'a, S> GetIndex<'a, S> for RangeFrom<usize> where
    S: Set + ValueType,
    Range<usize>: GetIndex<'a, S>, 
[src]

type Output = <Range<usize> as GetIndex<'a, S>>::Output

impl<'a, S: ValueType> GetIndex<'a, S> for RangeTo<usize> where
    Range<usize>: GetIndex<'a, S>, 
[src]

type Output = <Range<usize> as GetIndex<'a, S>>::Output

impl<'a, S: ValueType> GetIndex<'a, S> for RangeFull where
    S: Set,
    Range<usize>: GetIndex<'a, S>, 
[src]

type Output = <Range<usize> as GetIndex<'a, S>>::Output

impl<'a, S: ValueType> GetIndex<'a, S> for RangeInclusive<usize> where
    Range<usize>: GetIndex<'a, S>, 
[src]

type Output = <Range<usize> as GetIndex<'a, S>>::Output

impl<'a, S: ValueType> GetIndex<'a, S> for RangeToInclusive<usize> where
    Range<usize>: GetIndex<'a, S>, 
[src]

type Output = <Range<usize> as GetIndex<'a, S>>::Output

Loading content...

Implementors

impl<'a, S, N> GetIndex<'a, S> for StaticRange<N> where
    S: Set + ValueType,
    N: Unsigned,
    Range<usize>: GetIndex<'a, S>, 
[src]

type Output = <Range<usize> as GetIndex<'a, S>>::Output

impl<'a, T, I> GetIndex<'a, &'a [T]> for I where
    I: SliceIndex<[T]>,
    <[T] as Index<I>>::Output: 'a, 
[src]

type Output = &'a <[T] as Index<I>>::Output

impl<'a, T, N> GetIndex<'a, &'a [T; 10]> for StaticRange<N> where
    N: Unsigned + Array<T>,
    <N as Array<T>>::Array: 'a, 
[src]

type Output = &'a N::Array

impl<'a, T, N> GetIndex<'a, &'a [T; 11]> for StaticRange<N> where
    N: Unsigned + Array<T>,
    <N as Array<T>>::Array: 'a, 
[src]

type Output = &'a N::Array

impl<'a, T, N> GetIndex<'a, &'a [T; 12]> for StaticRange<N> where
    N: Unsigned + Array<T>,
    <N as Array<T>>::Array: 'a, 
[src]

type Output = &'a N::Array

impl<'a, T, N> GetIndex<'a, &'a [T; 13]> for StaticRange<N> where
    N: Unsigned + Array<T>,
    <N as Array<T>>::Array: 'a, 
[src]

type Output = &'a N::Array

impl<'a, T, N> GetIndex<'a, &'a [T; 14]> for StaticRange<N> where
    N: Unsigned + Array<T>,
    <N as Array<T>>::Array: 'a, 
[src]

type Output = &'a N::Array

impl<'a, T, N> GetIndex<'a, &'a [T; 15]> for StaticRange<N> where
    N: Unsigned + Array<T>,
    <N as Array<T>>::Array: 'a, 
[src]

type Output = &'a N::Array

impl<'a, T, N> GetIndex<'a, &'a [T; 16]> for StaticRange<N> where
    N: Unsigned + Array<T>,
    <N as Array<T>>::Array: 'a, 
[src]

type Output = &'a N::Array

impl<'a, T, N> GetIndex<'a, &'a [T; 1]> for StaticRange<N> where
    N: Unsigned + Array<T>,
    <N as Array<T>>::Array: 'a, 
[src]

type Output = &'a N::Array

impl<'a, T, N> GetIndex<'a, &'a [T; 2]> for StaticRange<N> where
    N: Unsigned + Array<T>,
    <N as Array<T>>::Array: 'a, 
[src]

type Output = &'a N::Array

impl<'a, T, N> GetIndex<'a, &'a [T; 3]> for StaticRange<N> where
    N: Unsigned + Array<T>,
    <N as Array<T>>::Array: 'a, 
[src]

type Output = &'a N::Array

impl<'a, T, N> GetIndex<'a, &'a [T; 4]> for StaticRange<N> where
    N: Unsigned + Array<T>,
    <N as Array<T>>::Array: 'a, 
[src]

type Output = &'a N::Array

impl<'a, T, N> GetIndex<'a, &'a [T; 5]> for StaticRange<N> where
    N: Unsigned + Array<T>,
    <N as Array<T>>::Array: 'a, 
[src]

type Output = &'a N::Array

impl<'a, T, N> GetIndex<'a, &'a [T; 6]> for StaticRange<N> where
    N: Unsigned + Array<T>,
    <N as Array<T>>::Array: 'a, 
[src]

type Output = &'a N::Array

impl<'a, T, N> GetIndex<'a, &'a [T; 7]> for StaticRange<N> where
    N: Unsigned + Array<T>,
    <N as Array<T>>::Array: 'a, 
[src]

type Output = &'a N::Array

impl<'a, T, N> GetIndex<'a, &'a [T; 8]> for StaticRange<N> where
    N: Unsigned + Array<T>,
    <N as Array<T>>::Array: 'a, 
[src]

type Output = &'a N::Array

impl<'a, T, N> GetIndex<'a, &'a [T; 9]> for StaticRange<N> where
    N: Unsigned + Array<T>,
    <N as Array<T>>::Array: 'a, 
[src]

type Output = &'a N::Array

impl<'a, T, N> GetIndex<'a, &'a [T]> for StaticRange<N> where
    N: Unsigned + Array<T>,
    <N as Array<T>>::Array: 'a, 
[src]

type Output = &'a N::Array

Loading content...