Trait columnar::common::index::Index

source ·
pub trait Index {
    type Ref;

    // Required method
    fn get(&self, index: usize) -> Self::Ref;

    // Provided methods
    fn last(&self) -> Option<Self::Ref>
       where Self: Len { ... }
    fn iter(&self) -> IterOwn<&Self>  { ... }
    fn into_iter(self) -> IterOwn<Self> 
       where Self: Sized { ... }
}
Expand description

A type that can be accessed by usize but without borrowing self.

This can be useful for types which include their own lifetimes, and which wish to express that their reference has the same lifetime. In the GAT Index, the Ref<'_> lifetime would be tied to &self.

This trait may be challenging to implement for owning containers, for example Vec<_>, which would need their Ref type to depend on the lifetime of the &self borrow in the get() function.

Required Associated Types§

source

type Ref

The type returned by the get method.

Notably, this does not vary with lifetime, and will not depend on the lifetime of &self.

Required Methods§

source

fn get(&self, index: usize) -> Self::Ref

Provided Methods§

source

fn last(&self) -> Option<Self::Ref>
where Self: Len,

source

fn iter(&self) -> IterOwn<&Self>

source

fn into_iter(self) -> IterOwn<Self>
where Self: Sized,

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'a, A> Index for &'a (A,)
where &'a A: Index,

§

type Ref = (<&'a A as Index>::Ref,)

source§

fn get(&self, index: usize) -> Self::Ref

source§

impl<'a, A, B> Index for &'a (A, B)

§

type Ref = (<&'a A as Index>::Ref, <&'a B as Index>::Ref)

source§

fn get(&self, index: usize) -> Self::Ref

source§

impl<'a, A, B, C> Index for &'a (A, B, C)

§

type Ref = (<&'a A as Index>::Ref, <&'a B as Index>::Ref, <&'a C as Index>::Ref)

source§

fn get(&self, index: usize) -> Self::Ref

source§

impl<'a, A, B, C, D> Index for &'a (A, B, C, D)

§

type Ref = (<&'a A as Index>::Ref, <&'a B as Index>::Ref, <&'a C as Index>::Ref, <&'a D as Index>::Ref)

source§

fn get(&self, index: usize) -> Self::Ref

source§

impl<'a, A, B, C, D, E> Index for &'a (A, B, C, D, E)

§

type Ref = (<&'a A as Index>::Ref, <&'a B as Index>::Ref, <&'a C as Index>::Ref, <&'a D as Index>::Ref, <&'a E as Index>::Ref)

source§

fn get(&self, index: usize) -> Self::Ref

source§

impl<'a, A, B, C, D, E, F> Index for &'a (A, B, C, D, E, F)

§

type Ref = (<&'a A as Index>::Ref, <&'a B as Index>::Ref, <&'a C as Index>::Ref, <&'a D as Index>::Ref, <&'a E as Index>::Ref, <&'a F as Index>::Ref)

source§

fn get(&self, index: usize) -> Self::Ref

source§

impl<'a, A, B, C, D, E, F, G> Index for &'a (A, B, C, D, E, F, G)

§

type Ref = (<&'a A as Index>::Ref, <&'a B as Index>::Ref, <&'a C as Index>::Ref, <&'a D as Index>::Ref, <&'a E as Index>::Ref, <&'a F as Index>::Ref, <&'a G as Index>::Ref)

source§

fn get(&self, index: usize) -> Self::Ref

source§

impl<'a, A, B, C, D, E, F, G, H> Index for &'a (A, B, C, D, E, F, G, H)

§

type Ref = (<&'a A as Index>::Ref, <&'a B as Index>::Ref, <&'a C as Index>::Ref, <&'a D as Index>::Ref, <&'a E as Index>::Ref, <&'a F as Index>::Ref, <&'a G as Index>::Ref, <&'a H as Index>::Ref)

source§

fn get(&self, index: usize) -> Self::Ref

source§

impl<'a, A, B, C, D, E, F, G, H, I> Index for &'a (A, B, C, D, E, F, G, H, I)

§

type Ref = (<&'a A as Index>::Ref, <&'a B as Index>::Ref, <&'a C as Index>::Ref, <&'a D as Index>::Ref, <&'a E as Index>::Ref, <&'a F as Index>::Ref, <&'a G as Index>::Ref, <&'a H as Index>::Ref, <&'a I as Index>::Ref)

source§

fn get(&self, index: usize) -> Self::Ref

source§

impl<'a, A, B, C, D, E, F, G, H, I, J> Index for &'a (A, B, C, D, E, F, G, H, I, J)

§

type Ref = (<&'a A as Index>::Ref, <&'a B as Index>::Ref, <&'a C as Index>::Ref, <&'a D as Index>::Ref, <&'a E as Index>::Ref, <&'a F as Index>::Ref, <&'a G as Index>::Ref, <&'a H as Index>::Ref, <&'a I as Index>::Ref, <&'a J as Index>::Ref)

source§

fn get(&self, index: usize) -> Self::Ref

source§

impl<'a, T> Index for &'a [T]

§

type Ref = &'a T

source§

fn get(&self, index: usize) -> Self::Ref

source§

impl<'a, T> Index for &'a Vec<T>

§

type Ref = &'a T

source§

fn get(&self, index: usize) -> Self::Ref

source§

impl<A: Index> Index for (A,)

§

type Ref = (<A as Index>::Ref,)

source§

fn get(&self, index: usize) -> Self::Ref

source§

impl<A: Index, B: Index> Index for (A, B)

§

type Ref = (<A as Index>::Ref, <B as Index>::Ref)

source§

fn get(&self, index: usize) -> Self::Ref

source§

impl<A: Index, B: Index, C: Index> Index for (A, B, C)

§

type Ref = (<A as Index>::Ref, <B as Index>::Ref, <C as Index>::Ref)

source§

fn get(&self, index: usize) -> Self::Ref

source§

impl<A: Index, B: Index, C: Index, D: Index> Index for (A, B, C, D)

§

type Ref = (<A as Index>::Ref, <B as Index>::Ref, <C as Index>::Ref, <D as Index>::Ref)

source§

fn get(&self, index: usize) -> Self::Ref

source§

impl<A: Index, B: Index, C: Index, D: Index, E: Index> Index for (A, B, C, D, E)

§

type Ref = (<A as Index>::Ref, <B as Index>::Ref, <C as Index>::Ref, <D as Index>::Ref, <E as Index>::Ref)

source§

fn get(&self, index: usize) -> Self::Ref

source§

impl<A: Index, B: Index, C: Index, D: Index, E: Index, F: Index> Index for (A, B, C, D, E, F)

§

type Ref = (<A as Index>::Ref, <B as Index>::Ref, <C as Index>::Ref, <D as Index>::Ref, <E as Index>::Ref, <F as Index>::Ref)

source§

fn get(&self, index: usize) -> Self::Ref

source§

impl<A: Index, B: Index, C: Index, D: Index, E: Index, F: Index, G: Index> Index for (A, B, C, D, E, F, G)

§

type Ref = (<A as Index>::Ref, <B as Index>::Ref, <C as Index>::Ref, <D as Index>::Ref, <E as Index>::Ref, <F as Index>::Ref, <G as Index>::Ref)

source§

fn get(&self, index: usize) -> Self::Ref

source§

impl<A: Index, B: Index, C: Index, D: Index, E: Index, F: Index, G: Index, H: Index> Index for (A, B, C, D, E, F, G, H)

§

type Ref = (<A as Index>::Ref, <B as Index>::Ref, <C as Index>::Ref, <D as Index>::Ref, <E as Index>::Ref, <F as Index>::Ref, <G as Index>::Ref, <H as Index>::Ref)

source§

fn get(&self, index: usize) -> Self::Ref

source§

impl<A: Index, B: Index, C: Index, D: Index, E: Index, F: Index, G: Index, H: Index, I: Index> Index for (A, B, C, D, E, F, G, H, I)

§

type Ref = (<A as Index>::Ref, <B as Index>::Ref, <C as Index>::Ref, <D as Index>::Ref, <E as Index>::Ref, <F as Index>::Ref, <G as Index>::Ref, <H as Index>::Ref, <I as Index>::Ref)

source§

fn get(&self, index: usize) -> Self::Ref

source§

impl<A: Index, B: Index, C: Index, D: Index, E: Index, F: Index, G: Index, H: Index, I: Index, J: Index> Index for (A, B, C, D, E, F, G, H, I, J)

§

type Ref = (<A as Index>::Ref, <B as Index>::Ref, <C as Index>::Ref, <D as Index>::Ref, <E as Index>::Ref, <F as Index>::Ref, <G as Index>::Ref, <H as Index>::Ref, <I as Index>::Ref, <J as Index>::Ref)

source§

fn get(&self, index: usize) -> Self::Ref

source§

impl<T: Copy> Index for [T]

§

type Ref = T

source§

fn get(&self, index: usize) -> Self::Ref

source§

impl<T: Copy> Index for Vec<T>

§

type Ref = T

source§

fn get(&self, index: usize) -> Self::Ref

Implementors§

source§

impl<'a> Index for &'a Jsons

§

type Ref = JsonsRef<'a>

source§

impl<'a, BC: Len + IndexAs<u64>> Index for &'a Strings<BC, Vec<u8>>

§

type Ref = &'a str

source§

impl<'a, BC: Len + IndexAs<u64>> Index for Strings<BC, &'a [u8]>

§

type Ref = &'a str

source§

impl<'a, CC> Index for &'a Empties<CC>

§

type Ref = &'a ()

source§

impl<'a, CV: IndexAs<i64>> Index for &'a Isizes<CV>

§

type Ref = isize

source§

impl<'a, CV: IndexAs<u64>> Index for &'a Usizes<CV>

§

type Ref = usize

source§

impl<'a, S> Index for &'a Slice<S>
where &'a S: Index,

§

type Ref = <&'a S as Index>::Ref

source§

impl<'a, SC, TC, CC, VC, WC> Index for &'a Results<SC, TC, CC, VC, WC>
where &'a SC: Index, &'a TC: Index, CC: IndexAs<u64> + Len, VC: IndexAs<u64> + Len, WC: Copy + CopyAs<u64>,

§

type Ref = Result<<&'a SC as Index>::Ref, <&'a TC as Index>::Ref>

source§

impl<'a, TC, BC: Len + IndexAs<u64>> Index for &'a Vecs<TC, BC>

source§

impl<'a, TC, CC: IndexAs<u64> + Len, VC: IndexAs<u64> + Len, WC: Copy + CopyAs<u64>> Index for &'a Options<TC, CC, VC, WC>
where &'a TC: Index,

§

type Ref = Option<<&'a TC as Index>::Ref>

source§

impl<'a, TC, const N: u8> Index for &'a Lookbacks<TC, Vec<u8>, N>
where &'a TC: Index,

§

type Ref = <&'a TC as Index>::Ref

source§

impl<CC> Index for Empties<CC>

§

type Ref = ()

source§

impl<CV: IndexAs<i64>> Index for Isizes<CV>

§

type Ref = isize

source§

impl<CV: IndexAs<u64>> Index for Usizes<CV>

§

type Ref = usize

source§

impl<S: Index> Index for Slice<S>

§

type Ref = <S as Index>::Ref

source§

impl<SC, TC, CC, VC, WC> Index for Results<SC, TC, CC, VC, WC>
where SC: Index, TC: Index, CC: IndexAs<u64> + Len, VC: IndexAs<u64> + Len, WC: Copy + CopyAs<u64>,

§

type Ref = Result<<SC as Index>::Ref, <TC as Index>::Ref>

source§

impl<SC: IndexAs<u64>, NC: IndexAs<u32>> Index for Durations<SC, NC>

source§

impl<TC: Copy, BC: Len + IndexAs<u64>> Index for Vecs<TC, BC>

§

type Ref = Slice<TC>

source§

impl<TC: Index, CC: IndexAs<u64> + Len, VC: IndexAs<u64> + Len, WC: Copy + CopyAs<u64>> Index for Options<TC, CC, VC, WC>

§

type Ref = Option<<TC as Index>::Ref>

source§

impl<TC: Index, VC: Index<Ref = u8>, const N: u8> Index for Lookbacks<TC, VC, N>

§

type Ref = <TC as Index>::Ref

source§

impl<TC: Index, const N: u8> Index for Repeats<TC, N>

§

type Ref = <TC as Index>::Ref

source§

impl<VC: Len + IndexAs<u64>, WC: Copy + CopyAs<u64>> Index for Bools<VC, WC>

§

type Ref = bool