Skip to main content

TrxScalar

Trait TrxScalar 

Source
pub trait TrxScalar:
    Pod
    + Zeroable
    + Copy
    + 'static
    + Debug {
    const DTYPE: DType;

    // Required methods
    fn to_f32(self) -> f32;
    fn to_f64(self) -> f64;
}
Expand description

Trait for scalar types that can be stored as TRX position coordinates.

Implementors must be [Pod] + [Zeroable] (for zero-copy casts) and carry their DType as an associated constant.

Required Associated Constants§

Required Methods§

Source

fn to_f32(self) -> f32

Convert to f32 for operations that need floating-point comparisons.

Source

fn to_f64(self) -> f64

Convert to f64 for operations that need higher precision.

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

Source§

const DTYPE: DType = DType::Float32

Source§

fn to_f32(self) -> f32

Source§

fn to_f64(self) -> f64

Source§

impl TrxScalar for f64

Source§

const DTYPE: DType = DType::Float64

Source§

fn to_f32(self) -> f32

Source§

fn to_f64(self) -> f64

Source§

impl TrxScalar for i8

Source§

const DTYPE: DType = DType::Int8

Source§

fn to_f32(self) -> f32

Source§

fn to_f64(self) -> f64

Source§

impl TrxScalar for i16

Source§

const DTYPE: DType = DType::Int16

Source§

fn to_f32(self) -> f32

Source§

fn to_f64(self) -> f64

Source§

impl TrxScalar for i32

Source§

const DTYPE: DType = DType::Int32

Source§

fn to_f32(self) -> f32

Source§

fn to_f64(self) -> f64

Source§

impl TrxScalar for i64

Source§

const DTYPE: DType = DType::Int64

Source§

fn to_f32(self) -> f32

Source§

fn to_f64(self) -> f64

Source§

impl TrxScalar for u8

Source§

const DTYPE: DType = DType::UInt8

Source§

fn to_f32(self) -> f32

Source§

fn to_f64(self) -> f64

Source§

impl TrxScalar for u16

Source§

const DTYPE: DType = DType::UInt16

Source§

fn to_f32(self) -> f32

Source§

fn to_f64(self) -> f64

Source§

impl TrxScalar for u32

Source§

const DTYPE: DType = DType::UInt32

Source§

fn to_f32(self) -> f32

Source§

fn to_f64(self) -> f64

Source§

impl TrxScalar for u64

Source§

const DTYPE: DType = DType::UInt64

Source§

fn to_f32(self) -> f32

Source§

fn to_f64(self) -> f64

Source§

impl TrxScalar for f16

Source§

const DTYPE: DType = DType::Float16

Source§

fn to_f32(self) -> f32

Source§

fn to_f64(self) -> f64

Implementors§