WithDType

Trait WithDType 

Source
pub trait WithDType:
    Sized
    + Copy
    + NumAssign
    + PartialOrd
    + Display
    + 'static
    + Send
    + Sync
    + Any
    + VecOps {
    const DTYPE: DType;

    // Required methods
    fn from_f64(v: f64) -> Self;
    fn to_f64(self) -> f64;
    fn to_scalar(self) -> Scalar;
    fn cpu_storage_ref(data: &[Self]) -> CpuStorageRef<'_>;
    fn to_cpu_storage_owned(data: Vec<Self>) -> CpuStorage;
    fn cpu_storage_as_slice(s: &CpuStorage) -> Result<&[Self]>;
    fn cpu_storage_data(s: CpuStorage) -> Result<Vec<Self>>;

    // Provided method
    fn to_cpu_storage(data: &[Self]) -> CpuStorage { ... }
}

Required Associated Constants§

Required Methods§

Provided Methods§

Source

fn to_cpu_storage(data: &[Self]) -> CpuStorage

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

Source§

impl WithDType for f64

Source§

impl WithDType for i64

Source§

impl WithDType for u8

Source§

impl WithDType for u32

Source§

impl WithDType for bf16

Source§

impl WithDType for f16

Implementors§