pub trait SlotDevice {
// Required methods
fn write_slot(
&mut self,
bank: usize,
dst_slot: u32,
src: &[u8],
) -> Result<(), String>;
fn copy_slot(
&mut self,
bank: usize,
dst_slot: u32,
src_slot: u32,
) -> Result<(), String>;
// Provided methods
fn begin_plan(&mut self, route: CopyRoute) -> Result<(), String> { ... }
fn flush(&mut self) -> Result<(), String> { ... }
}Expand description
Where a slot’s bytes actually live.
One implementation per backend. Both methods take a bank index and absolute slot numbers; translating those into an address is the implementation’s business, which is what keeps this crate free of device memory.
Implementations may defer the work and do it in flush
– an async copy engine is the normal case – but must not report
success for a copy they later discover failed without failing the
flush.
Required Methods§
Provided Methods§
Sourcefn begin_plan(&mut self, route: CopyRoute) -> Result<(), String>
fn begin_plan(&mut self, route: CopyRoute) -> Result<(), String>
Announces how the copies about to be issued must be carried out. Called once per plan, before the first copy.
The default ignores it, which is right for any backend whose
copies are already synchronous. A backend that captures work
into a graph must not capture a
CopyRoute::WholeLayerPageable plan: that route exists
precisely because the layer’s host rows have no device address,
so its copy is a synchronous pageable one and a captured graph
would replay a transfer whose source is not addressable.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".