Skip to main content

Indexable

Trait Indexable 

Source
pub trait Indexable<T>: Send + Sync {
    // Required methods
    fn get(&self, i: usize) -> &[T];
    fn len(&self) -> usize;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

A trait representing a dataset that can be accessed into vector chunks.

This abstracts over the actual memory layout of the dataset, allowing the knn function to seamlessly map over a sliced array (&[T], dim), vectors of vectors Vec<Vec<T>>, or arrays of references Vec<&[T]>.

Required Methods§

Source

fn get(&self, i: usize) -> &[T]

Source

fn len(&self) -> usize

Provided Methods§

Source

fn is_empty(&self) -> bool

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T, C> Indexable<T> for (C, usize)
where T: Send + Sync, C: AsRef<[T]> + Send + Sync,

Source§

fn get(&self, i: usize) -> &[T]

Source§

fn len(&self) -> usize

Source§

impl<T, U> Indexable<T> for &Vec<U>
where T: Send + Sync, U: AsRef<[T]> + Send + Sync,

Source§

fn get(&self, i: usize) -> &[T]

Source§

fn len(&self) -> usize

Source§

impl<T, U> Indexable<T> for &[U]
where T: Send + Sync, U: AsRef<[T]> + Send + Sync,

Source§

fn get(&self, i: usize) -> &[T]

Source§

fn len(&self) -> usize

Source§

impl<T, U> Indexable<T> for Vec<U>
where T: Send + Sync, U: AsRef<[T]> + Send + Sync,

Source§

fn get(&self, i: usize) -> &[T]

Source§

fn len(&self) -> usize

Implementors§