Skip to main content

Element

Trait Element 

Source
pub trait Element:
    Copy
    + Send
    + Sync
    + 'static
    + Item {
    const FILL: Self;
    const DTYPE: DType;

    // Required methods
    fn of(view: View<'_>) -> Option<&[Self]>;
    fn of_mut(buffer: &mut Buffer) -> Option<&mut [Self]>;
    fn view(items: &[Self]) -> View<'_>;
    fn buffer(data: Vec<Self>) -> Buffer;
    fn vec(buffer: Buffer) -> Option<Vec<Self>>;
    fn vec_mut(buffer: &mut Buffer) -> Option<&mut Vec<Self>>;
    fn truth(b: bool) -> Self;
}
Expand description

An element type of compact buffers: bool, the integer widths u8, i16, i32 and i64, the float widths half::f16, f32 and f64, Complex32 and Complex64, and char.

Required Associated Constants§

Source

const FILL: Self

The item that a missing keyed entry reads as: zero, false or a space.

Source

const DTYPE: DType

The dtype of buffers of this type.

Required Methods§

Source

fn of(view: View<'_>) -> Option<&[Self]>

The items of view, when they have this type.

Source

fn of_mut(buffer: &mut Buffer) -> Option<&mut [Self]>

The writable items of buffer, when they have this type. The allocation and length don’t change.

Source

fn view(items: &[Self]) -> View<'_>

items as a view.

Source

fn buffer(data: Vec<Self>) -> Buffer

A buffer that holds data.

Source

fn vec(buffer: Buffer) -> Option<Vec<Self>>

The items of buffer, moved out, when they have this type.

Source

fn vec_mut(buffer: &mut Buffer) -> Option<&mut Vec<Self>>

The items of buffer as their vector, when they have this type, for a writer that appends or clears them.

Source

fn truth(b: bool) -> Self

b as an item of this type: 1 or 0 for a number, the Boolean itself, or the characters U+0001 and U+0000. A Boolean mask becomes lanes of the items that a kernel such as Choose chooses between. A number converts through an integer, which suits stored Booleans. A comparison’s lane mask turns into 1 or 0 faster by a choice between the two, so Indicator writes its own (tolerant::indicated).

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Element for Complex32

Source§

const FILL: Self

Source§

const DTYPE: DType

Source§

fn of(view: View<'_>) -> Option<&[Self]>

Source§

fn of_mut(buffer: &mut Buffer) -> Option<&mut [Self]>

Source§

fn view(items: &[Self]) -> View<'_>

Source§

fn buffer(data: Vec<Self>) -> Buffer

Source§

fn vec(buffer: Buffer) -> Option<Vec<Self>>

Source§

fn vec_mut(buffer: &mut Buffer) -> Option<&mut Vec<Self>>

Source§

fn truth(b: bool) -> Self

Source§

impl Element for Complex64

Source§

const FILL: Self

Source§

const DTYPE: DType

Source§

fn of(view: View<'_>) -> Option<&[Self]>

Source§

fn of_mut(buffer: &mut Buffer) -> Option<&mut [Self]>

Source§

fn view(items: &[Self]) -> View<'_>

Source§

fn buffer(data: Vec<Self>) -> Buffer

Source§

fn vec(buffer: Buffer) -> Option<Vec<Self>>

Source§

fn vec_mut(buffer: &mut Buffer) -> Option<&mut Vec<Self>>

Source§

fn truth(b: bool) -> Self

Source§

impl Element for bool

Source§

const FILL: Self = false

Source§

const DTYPE: DType = DType::Boolean

Source§

fn of(view: View<'_>) -> Option<&[Self]>

Source§

fn of_mut(buffer: &mut Buffer) -> Option<&mut [Self]>

Source§

fn view(items: &[Self]) -> View<'_>

Source§

fn buffer(data: Vec<Self>) -> Buffer

Source§

fn vec(buffer: Buffer) -> Option<Vec<Self>>

Source§

fn vec_mut(buffer: &mut Buffer) -> Option<&mut Vec<Self>>

Source§

fn truth(b: bool) -> Self

Source§

impl Element for char

Source§

const FILL: Self = ' '

Source§

const DTYPE: DType = DType::Character

Source§

fn of(view: View<'_>) -> Option<&[Self]>

Source§

fn of_mut(buffer: &mut Buffer) -> Option<&mut [Self]>

Source§

fn view(items: &[Self]) -> View<'_>

Source§

fn buffer(data: Vec<Self>) -> Buffer

Source§

fn vec(buffer: Buffer) -> Option<Vec<Self>>

Source§

fn vec_mut(buffer: &mut Buffer) -> Option<&mut Vec<Self>>

Source§

fn truth(b: bool) -> Self

Source§

impl Element for f16

Source§

const FILL: Self = half::f16::ZERO

Source§

const DTYPE: DType

Source§

fn of(view: View<'_>) -> Option<&[Self]>

Source§

fn of_mut(buffer: &mut Buffer) -> Option<&mut [Self]>

Source§

fn view(items: &[Self]) -> View<'_>

Source§

fn buffer(data: Vec<Self>) -> Buffer

Source§

fn vec(buffer: Buffer) -> Option<Vec<Self>>

Source§

fn vec_mut(buffer: &mut Buffer) -> Option<&mut Vec<Self>>

Source§

fn truth(b: bool) -> Self

Source§

impl Element for f32

Source§

const FILL: Self = 0.0

Source§

const DTYPE: DType

Source§

fn of(view: View<'_>) -> Option<&[Self]>

Source§

fn of_mut(buffer: &mut Buffer) -> Option<&mut [Self]>

Source§

fn view(items: &[Self]) -> View<'_>

Source§

fn buffer(data: Vec<Self>) -> Buffer

Source§

fn vec(buffer: Buffer) -> Option<Vec<Self>>

Source§

fn vec_mut(buffer: &mut Buffer) -> Option<&mut Vec<Self>>

Source§

fn truth(b: bool) -> Self

Source§

impl Element for f64

Source§

const FILL: Self = 0.0

Source§

const DTYPE: DType

Source§

fn of(view: View<'_>) -> Option<&[Self]>

Source§

fn of_mut(buffer: &mut Buffer) -> Option<&mut [Self]>

Source§

fn view(items: &[Self]) -> View<'_>

Source§

fn buffer(data: Vec<Self>) -> Buffer

Source§

fn vec(buffer: Buffer) -> Option<Vec<Self>>

Source§

fn vec_mut(buffer: &mut Buffer) -> Option<&mut Vec<Self>>

Source§

fn truth(b: bool) -> Self

Source§

impl Element for i16

Source§

const FILL: Self = 0

Source§

const DTYPE: DType

Source§

fn of(view: View<'_>) -> Option<&[Self]>

Source§

fn of_mut(buffer: &mut Buffer) -> Option<&mut [Self]>

Source§

fn view(items: &[Self]) -> View<'_>

Source§

fn buffer(data: Vec<Self>) -> Buffer

Source§

fn vec(buffer: Buffer) -> Option<Vec<Self>>

Source§

fn vec_mut(buffer: &mut Buffer) -> Option<&mut Vec<Self>>

Source§

fn truth(b: bool) -> Self

Source§

impl Element for i32

Source§

const FILL: Self = 0

Source§

const DTYPE: DType

Source§

fn of(view: View<'_>) -> Option<&[Self]>

Source§

fn of_mut(buffer: &mut Buffer) -> Option<&mut [Self]>

Source§

fn view(items: &[Self]) -> View<'_>

Source§

fn buffer(data: Vec<Self>) -> Buffer

Source§

fn vec(buffer: Buffer) -> Option<Vec<Self>>

Source§

fn vec_mut(buffer: &mut Buffer) -> Option<&mut Vec<Self>>

Source§

fn truth(b: bool) -> Self

Source§

impl Element for i64

Source§

const FILL: Self = 0

Source§

const DTYPE: DType

Source§

fn of(view: View<'_>) -> Option<&[Self]>

Source§

fn of_mut(buffer: &mut Buffer) -> Option<&mut [Self]>

Source§

fn view(items: &[Self]) -> View<'_>

Source§

fn buffer(data: Vec<Self>) -> Buffer

Source§

fn vec(buffer: Buffer) -> Option<Vec<Self>>

Source§

fn vec_mut(buffer: &mut Buffer) -> Option<&mut Vec<Self>>

Source§

fn truth(b: bool) -> Self

Source§

impl Element for u8

Source§

const FILL: Self = 0

Source§

const DTYPE: DType

Source§

fn of(view: View<'_>) -> Option<&[Self]>

Source§

fn of_mut(buffer: &mut Buffer) -> Option<&mut [Self]>

Source§

fn view(items: &[Self]) -> View<'_>

Source§

fn buffer(data: Vec<Self>) -> Buffer

Source§

fn vec(buffer: Buffer) -> Option<Vec<Self>>

Source§

fn vec_mut(buffer: &mut Buffer) -> Option<&mut Vec<Self>>

Source§

fn truth(b: bool) -> Self

Implementors§