Trait narrow::Index

source ·
pub trait Index: Length {
    type Item<'a>
       where Self: 'a;

    // Required method
    unsafe fn index_unchecked(&self, index: usize) -> Self::Item<'_>;

    // Provided methods
    fn index(&self, index: usize) -> Option<Self::Item<'_>> { ... }
    fn index_checked(&self, index: usize) -> Self::Item<'_> { ... }
}
Expand description

Index operation for shared access to values in a collection.

Required Associated Types§

source

type Item<'a> where Self: 'a

The item.

Required Methods§

source

unsafe fn index_unchecked(&self, index: usize) -> Self::Item<'_>

Returns the value at given index. Skips bound checking.

§Safety

Caller must ensure index is within bounds.

Provided Methods§

source

fn index(&self, index: usize) -> Option<Self::Item<'_>>

Returns the value at given index. Returns None if the index is out of range.

source

fn index_checked(&self, index: usize) -> Self::Item<'_>

Returns the value at given index. Panics if the index is out of bounds.

§Panics

Panics if the index is out of bounds.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T> Index for &[T]

§

type Item<'a> = &'a T where Self: 'a

source§

unsafe fn index_unchecked(&self, index: usize) -> Self::Item<'_>

source§

impl<T> Index for &mut [T]

§

type Item<'a> = &'a T where Self: 'a

source§

unsafe fn index_unchecked(&self, index: usize) -> Self::Item<'_>

source§

impl<T> Index for [T]

§

type Item<'a> = &'a T where Self: 'a

source§

unsafe fn index_unchecked(&self, index: usize) -> Self::Item<'_>

source§

impl<T> Index for Box<[T]>

§

type Item<'a> = &'a T where Self: 'a

source§

unsafe fn index_unchecked(&self, index: usize) -> Self::Item<'_>

source§

impl<T> Index for VecDeque<T>

§

type Item<'a> = &'a T where Self: 'a

source§

unsafe fn index_unchecked(&self, index: usize) -> Self::Item<'_>

source§

impl<T> Index for Rc<[T]>

§

type Item<'a> = &'a T where Self: 'a

source§

unsafe fn index_unchecked(&self, index: usize) -> Self::Item<'_>

source§

impl<T> Index for Arc<[T]>

§

type Item<'a> = &'a T where Self: 'a

source§

unsafe fn index_unchecked(&self, index: usize) -> Self::Item<'_>

source§

impl<T> Index for Vec<T>

§

type Item<'a> = &'a T where Self: 'a

source§

unsafe fn index_unchecked(&self, index: usize) -> Self::Item<'_>

source§

impl<T, const N: usize> Index for [T; N]

§

type Item<'a> = &'a T where Self: 'a

source§

unsafe fn index_unchecked(&self, index: usize) -> Self::Item<'_>

source§

impl<T: FixedSize> Index for ScalarBuffer<T>

Available on crate feature arrow-rs only.
§

type Item<'a> = &'a T where Self: 'a

source§

unsafe fn index_unchecked(&self, index: usize) -> Self::Item<'_>

source§

impl<T: FixedSize> Index for BufferBuilder<T>

Available on crate feature arrow-rs only.
§

type Item<'a> = &'a T where Self: 'a

source§

unsafe fn index_unchecked(&self, index: usize) -> Self::Item<'_>

Implementors§

source§

impl<Buffer: BufferType> Index for Bitmap<Buffer>

§

type Item<'a> = bool where Self: 'a

source§

impl<OffsetItem: OffsetElement, Buffer: BufferType> Index for StringArray<false, OffsetItem, Buffer>

§

type Item<'a> = &'a str where Self: 'a

source§

impl<OffsetItem: OffsetElement, Buffer: BufferType> Index for StringArray<true, OffsetItem, Buffer>

§

type Item<'a> = Option<&'a str> where Self: 'a

source§

impl<OffsetItem: OffsetElement, Buffer: BufferType> Index for VariableSizeBinaryArray<false, OffsetItem, Buffer>
where <Buffer as BufferType>::Buffer<OffsetItem>: Index,

§

type Item<'a> = &'a [u8] where Self: 'a

source§

impl<OffsetItem: OffsetElement, Buffer: BufferType> Index for VariableSizeBinaryArray<true, OffsetItem, Buffer>
where <Buffer as BufferType>::Buffer<OffsetItem>: Index,

§

type Item<'a> = Option<&'a [u8]> where Self: 'a

source§

impl<T, OffsetItem: OffsetElement, Buffer: BufferType> Index for Offset<T, false, OffsetItem, Buffer>

§

type Item<'a> = OffsetSlice<'a, T, false, OffsetItem, Buffer> where Self: 'a

source§

impl<T, OffsetItem: OffsetElement, Buffer: BufferType> Index for Offset<T, true, OffsetItem, Buffer>

§

type Item<'a> = Option<OffsetSlice<'a, T, true, OffsetItem, Buffer>> where Self: 'a

source§

impl<T: Array, const NULLABLE: bool, OffsetItem: OffsetElement, Buffer: BufferType> Index for VariableSizeListArray<T, NULLABLE, OffsetItem, Buffer>
where <Buffer as BufferType>::Buffer<OffsetItem>: Validity<NULLABLE>, Offset<T, NULLABLE, OffsetItem, Buffer>: Index,

§

type Item<'a> = <Offset<T, NULLABLE, OffsetItem, Buffer> as Index>::Item<'a> where Self: 'a

source§

impl<T: Unit> Index for Nulls<T>

§

type Item<'a> = T where Self: 'a

source§

impl<T: Unit, const NULLABLE: bool, Buffer: BufferType> Index for NullArray<T, NULLABLE, Buffer>
where Nulls<T>: Validity<NULLABLE>, <Nulls<T> as Validity<NULLABLE>>::Storage<Buffer>: Index,

§

type Item<'a> = <<Nulls<T> as Validity<NULLABLE>>::Storage<Buffer> as Index>::Item<'a> where Self: 'a

source§

impl<T: FixedSize, Buffer: BufferType, const NULLABLE: bool> Index for FixedSizePrimitiveArray<T, NULLABLE, Buffer>
where <Buffer as BufferType>::Buffer<T>: Validity<NULLABLE>, <<Buffer as BufferType>::Buffer<T> as Validity<NULLABLE>>::Storage<Buffer>: Index,

§

type Item<'a> = <<<Buffer as BufferType>::Buffer<T> as Validity<NULLABLE>>::Storage<Buffer> as Index>::Item<'a> where Self: 'a

source§

impl<const N: usize, T, Buffer: BufferType> Index for FixedSizeListArray<N, T, false, Buffer>
where T: Index + Array,

§

type Item<'a> = [<T as Index>::Item<'a>; N] where Self: 'a

source§

impl<const N: usize, T, Buffer: BufferType> Index for FixedSizeListArray<N, T, true, Buffer>
where T: Index + Array,

§

type Item<'a> = Option<[<T as Index>::Item<'a>; N]> where Self: 'a

source§

impl<const N: usize, const NULLABLE: bool, Buffer: BufferType> Index for FixedSizeBinaryArray<N, NULLABLE, Buffer>
where FixedSizePrimitiveArray<u8, false, Buffer>: Validity<NULLABLE>, FixedSizeListArray<N, FixedSizePrimitiveArray<u8, false, Buffer>, NULLABLE, Buffer>: Index,

§

type Item<'a> = <FixedSizeListArray<N, FixedSizePrimitiveArray<u8, false, Buffer>, NULLABLE, Buffer> as Index>::Item<'a> where Self: 'a

source§

impl<const NULLABLE: bool, Buffer: BufferType> Index for BooleanArray<NULLABLE, Buffer>
where Bitmap<Buffer>: Validity<NULLABLE>, <Bitmap<Buffer> as Validity<NULLABLE>>::Storage<Buffer>: Index,

§

type Item<'a> = <<Bitmap<Buffer> as Validity<NULLABLE>>::Storage<Buffer> as Index>::Item<'a> where Self: 'a