Skip to main content

ValueInterface

Trait ValueInterface 

Source
pub trait ValueInterface:
    Debug
    + Sized
    + Clone
    + PartialEq
    + Send
    + Sync {
    // Required methods
    fn datum_type(&self) -> Result<DatumType>;
    fn from_bytes(dt: DatumType, shape: &[usize], data: &[u8]) -> Result<Self>;
    fn as_bytes(&self) -> Result<(DatumType, &[usize], &[u8])>;
    fn convert_to(&self, to: DatumType) -> Result<Self>;

    // Provided methods
    fn from_slice<T: Datum>(shape: &[usize], data: &[T]) -> Result<Self> { ... }
    fn as_slice<T: Datum>(&self) -> Result<&[T]> { ... }
    fn as_shape_and_slice<T: Datum>(&self) -> Result<(&[usize], &[T])> { ... }
    fn shape(&self) -> Result<&[usize]> { ... }
    fn view<T: Datum>(&self) -> Result<ArrayViewD<'_, T>> { ... }
}

Required Methods§

Source

fn datum_type(&self) -> Result<DatumType>

Source

fn from_bytes(dt: DatumType, shape: &[usize], data: &[u8]) -> Result<Self>

Source

fn as_bytes(&self) -> Result<(DatumType, &[usize], &[u8])>

Source

fn convert_to(&self, to: DatumType) -> Result<Self>

Provided Methods§

Source

fn from_slice<T: Datum>(shape: &[usize], data: &[T]) -> Result<Self>

Source

fn as_slice<T: Datum>(&self) -> Result<&[T]>

Source

fn as_shape_and_slice<T: Datum>(&self) -> Result<(&[usize], &[T])>

Source

fn shape(&self) -> Result<&[usize]>

Source

fn view<T: Datum>(&self) -> Result<ArrayViewD<'_, T>>

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.

Implementors§