Trait collenchyma::device::IDevice
[−]
[src]
pub trait IDevice {
type H: IHardware;
type M: IMemory;
fn id(&self) -> &isize;
fn hardwares(&self) -> &Vec<Self::H>;
fn alloc_memory(&self, size: usize) -> Result<Self::M, Error>;
fn sync_in(&self, source: &DeviceType, source_data: &MemoryType, dest_data: &mut Self::M) -> Result<(), Error>;
}Specifies Hardware behavior across frameworks.
Associated Types
type H: IHardware
The Hardware representation for this Device.
type M: IMemory
The Memory representation for this Device.
Required Methods
fn id(&self) -> &isize
Returns the unique identifier of the Device.
fn hardwares(&self) -> &Vec<Self::H>
Returns the hardwares, which define the Device.
fn alloc_memory(&self, size: usize) -> Result<Self::M, Error>
Allocate memory on the Device.
fn sync_in(&self, source: &DeviceType, source_data: &MemoryType, dest_data: &mut Self::M) -> Result<(), Error>
Synchronize memory from source_data to the memory at dest_data.
Defines how data is synchronized into the device.
All Frameworks, except Native(host), are also defining a sync_out method.