Slice

Trait Slice 

Source
pub trait Slice: Debug {
    type Device: Device<Slice = Self>;

    // Required methods
    fn device(&self) -> &Self::Device;
    fn dtype(&self) -> DType;
    fn len(&self) -> usize;
    fn copy_host_to_device<DT>(&mut self, src: &[DT]) -> Result<(), Error>
       where DT: WithDType;
    fn copy_device_to_host<DT>(&self, dst: &mut [DT]) -> Result<(), Error>
       where DT: WithDType;

    // Provided methods
    fn is_empty(&self) -> bool { ... }
    fn to_vec<DT>(&self) -> Result<Vec<DT>, Error>
       where DT: WithDType { ... }
}

Required Associated Types§

Source

type Device: Device<Slice = Self>

Required Methods§

Source

fn device(&self) -> &Self::Device

Source

fn dtype(&self) -> DType

Source

fn len(&self) -> usize

Source

fn copy_host_to_device<DT>(&mut self, src: &[DT]) -> Result<(), Error>
where DT: WithDType,

Source

fn copy_device_to_host<DT>(&self, dst: &mut [DT]) -> Result<(), Error>
where DT: WithDType,

Provided Methods§

Source

fn is_empty(&self) -> bool

Source

fn to_vec<DT>(&self) -> Result<Vec<DT>, Error>
where DT: WithDType,

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§