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§
Required Methods§
sourceunsafe fn index_unchecked(&self, index: usize) -> Self::Item<'_>
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§
sourcefn index(&self, index: usize) -> Option<Self::Item<'_>>
fn index(&self, index: usize) -> Option<Self::Item<'_>>
Returns the value at given index. Returns None if the index is out of range.
sourcefn index_checked(&self, index: usize) -> Self::Item<'_>
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: FixedSize> Index for ScalarBuffer<T>
Available on crate feature arrow-rs only.
impl<T: FixedSize> Index for ScalarBuffer<T>
Available on crate feature
arrow-rs only.source§impl<T: FixedSize> Index for BufferBuilder<T>
Available on crate feature arrow-rs only.
impl<T: FixedSize> Index for BufferBuilder<T>
Available on crate feature
arrow-rs only.