Trait popcorn::device::Device
[−]
[src]
pub trait Device { type H: Hardware; type M: Memory; type Error: Debug + Clone; fn id(&self) -> isize; fn hardware(&self) -> &Self::H; fn alloc_memory(&self, size: usize) -> Result<Self::M, Self::Error>; fn sync_from_vec<T: Send + Copy + Sized + 'static>(
&self,
mem: Self::M,
vec: Vec<T>
) -> Box<Future<Item = Self::M, Error = Self::Error>>; fn sync_to_vec<T: Send + Copy + Sized + 'static>(
&self,
mem: Self::M
) -> Box<Future<Item = (Self::M, Vec<T>), Error = Self::Error>>; }
Specifies Hardware behavior across frameworks.
Associated Types
type H: Hardware
The Hardware representation for this Device.
type M: Memory
The Memory representation for this Device.
type Error: Debug + Clone
The Error representation for this Device.
Required Methods
fn id(&self) -> isize
Returns the unique identifier of the Device.
fn hardware(&self) -> &Self::H
Returns the hardware, which defines the Device.
fn alloc_memory(&self, size: usize) -> Result<Self::M, Self::Error>
Allocates a new buffer on the Device.
fn sync_from_vec<T: Send + Copy + Sized + 'static>(
&self,
mem: Self::M,
vec: Vec<T>
) -> Box<Future<Item = Self::M, Error = Self::Error>>
&self,
mem: Self::M,
vec: Vec<T>
) -> Box<Future<Item = Self::M, Error = Self::Error>>
Sync data from Vec into memory
fn sync_to_vec<T: Send + Copy + Sized + 'static>(
&self,
mem: Self::M
) -> Box<Future<Item = (Self::M, Vec<T>), Error = Self::Error>>
&self,
mem: Self::M
) -> Box<Future<Item = (Self::M, Vec<T>), Error = Self::Error>>
Sync data from device to Vec
Implementors
impl Device for Device