Scalar

Trait Scalar 

Source
pub trait Scalar:
    LinalgScalar
    + Debug
    + Clone
    + Copy
    + PartialEq
    + Num {
    const BITS: usize;

    // Provided methods
    fn size_in_bytes_from_length(length: usize) -> usize { ... }
    fn length_from_bytes(bytes: usize) -> usize { ... }
}
Expand description

A trait for scalar types.

Required Associated Constants§

Source

const BITS: usize

Number of bits per element.

Provided Methods§

Source

fn size_in_bytes_from_length(length: usize) -> usize

Returns the byte size for length elements of this scalar type.

Panics if the total bit count is not a multiple of 8.

Source

fn length_from_bytes(bytes: usize) -> usize

Returns the number of elements that fit in bytes bytes.

Panics if the byte count does not evenly divide into whole elements.

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 Scalar for f32

Source§

const BITS: usize = 32usize

Source§

impl Scalar for i8

Source§

const BITS: usize = 8usize

Source§

impl Scalar for i16

Source§

const BITS: usize = 16usize

Source§

impl Scalar for i32

Source§

const BITS: usize = 32usize

Source§

impl Scalar for u8

Source§

const BITS: usize = 8usize

Implementors§

Source§

impl Scalar for bf16

Source§

const BITS: usize = 16usize

Source§

impl Scalar for f8

Source§

const BITS: usize = 8usize

Source§

impl Scalar for f8e4m3

Source§

const BITS: usize = 8usize

Source§

impl Scalar for i4

Source§

const BITS: usize = 4usize