Trait ElemType

Source
pub trait ElemType:
    Clone
    + Copy
    + Debug
    + PartialEq
    + 'static {
    type DType: Type<Repr = Self>;

    // Required methods
    fn zero() -> Self;
    fn one() -> Self;
    fn elem_count(start: Self, stop: Self, step: Self) -> usize;

    // Provided method
    fn from_f64(val: f64) -> Option<Self> { ... }
}

Required Associated Types§

Source

type DType: Type<Repr = Self>

Required Methods§

Source

fn zero() -> Self

Source

fn one() -> Self

Source

fn elem_count(start: Self, stop: Self, step: Self) -> usize

Provided Methods§

Source

fn from_f64(val: f64) -> Option<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.

Implementations on Foreign Types§

Source§

impl ElemType for f32

Source§

type DType = F32

Source§

fn zero() -> Self

Source§

fn one() -> Self

Source§

fn elem_count(start: Self, stop: Self, step: Self) -> usize

Source§

fn from_f64(val: f64) -> Option<Self>

Source§

impl ElemType for f64

Source§

type DType = F64

Source§

fn zero() -> Self

Source§

fn one() -> Self

Source§

fn elem_count(start: Self, stop: Self, step: Self) -> usize

Source§

fn from_f64(val: f64) -> Option<Self>

Source§

impl ElemType for i64

Source§

type DType = I64

Source§

fn zero() -> Self

Source§

fn one() -> Self

Source§

fn elem_count(start: Self, stop: Self, step: Self) -> usize

Source§

impl ElemType for u8

Source§

type DType = U8

Source§

fn zero() -> Self

Source§

fn one() -> Self

Source§

fn elem_count(start: Self, stop: Self, step: Self) -> usize

Source§

impl ElemType for u32

Source§

type DType = U32

Source§

fn zero() -> Self

Source§

fn one() -> Self

Source§

fn elem_count(start: Self, stop: Self, step: Self) -> usize

Source§

impl ElemType for bf16

Source§

type DType = BF16

Source§

fn zero() -> Self

Source§

fn one() -> Self

Source§

fn elem_count(start: Self, stop: Self, step: Self) -> usize

Source§

fn from_f64(val: f64) -> Option<Self>

Source§

impl ElemType for f16

Source§

type DType = F16

Source§

fn zero() -> Self

Source§

fn one() -> Self

Source§

fn elem_count(start: Self, stop: Self, step: Self) -> usize

Source§

fn from_f64(val: f64) -> Option<Self>

Implementors§