datatypes::scalars

Trait ScalarVector

Source
pub trait ScalarVector:
    Vector
    + Send
    + Sync
    + Sized
    + 'static
where for<'a> Self::OwnedItem: Scalar<RefType<'a> = Self::RefItem<'a>>,
{ type OwnedItem: Scalar<VectorType = Self>; type RefItem<'a>: ScalarRef<'a, ScalarType = Self::OwnedItem> where Self: 'a; type Iter<'a>: Iterator<Item = Option<Self::RefItem<'a>>> where Self: 'a; type Builder: ScalarVectorBuilder<VectorType = Self>; // Required methods fn get_data(&self, idx: usize) -> Option<Self::RefItem<'_>>; fn iter_data(&self) -> Self::Iter<'_>; // Provided methods fn from_slice(data: &[Self::RefItem<'_>]) -> Self { ... } fn from_iterator<'a>(it: impl Iterator<Item = Self::RefItem<'a>>) -> Self { ... } fn from_owned_iterator( it: impl Iterator<Item = Option<Self::OwnedItem>>, ) -> Self { ... } fn from_vec<I: Into<Self::OwnedItem>>(values: Vec<I>) -> Self { ... } }
Expand description

A sub trait of Vector to add scalar operation support.

Required Associated Types§

Source

type OwnedItem: Scalar<VectorType = Self>

Source

type RefItem<'a>: ScalarRef<'a, ScalarType = Self::OwnedItem> where Self: 'a

The reference item of this vector.

Source

type Iter<'a>: Iterator<Item = Option<Self::RefItem<'a>>> where Self: 'a

Iterator type of this vector.

Source

type Builder: ScalarVectorBuilder<VectorType = Self>

Builder type to build this vector.

Required Methods§

Source

fn get_data(&self, idx: usize) -> Option<Self::RefItem<'_>>

Returns the reference to an element at given position.

Note: get() has bad performance, avoid call this function inside loop.

§Panics

Panics if idx >= self.len().

Source

fn iter_data(&self) -> Self::Iter<'_>

Returns iterator of current vector.

Provided Methods§

Source

fn from_slice(data: &[Self::RefItem<'_>]) -> Self

Source

fn from_iterator<'a>(it: impl Iterator<Item = Self::RefItem<'a>>) -> Self

Source

fn from_owned_iterator( it: impl Iterator<Item = Option<Self::OwnedItem>>, ) -> Self

Source

fn from_vec<I: Into<Self::OwnedItem>>(values: Vec<I>) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§