pub struct LoaderDevice<L> { /* private fields */ }Expand description
A portable VFS character device providing runtime model loading.
A platform mounts an instance of LoaderDevice (for example at /devices/nn/cpu).
Handles start in a staging state where model bytes are written sequentially. After
a LOAD control command is issued, the handle transitions to ready state and
behaves identically to a NeuralNetworkDevice handle.
Implementations§
Trait Implementations§
Source§impl<L: Loader> BaseOperations for LoaderDevice<L>
impl<L: Loader> BaseOperations for LoaderDevice<L>
fn open(&self, context: &mut Context) -> Result<()>
fn close(&self, context: &mut Context) -> Result<()>
fn read( &self, context: &mut Context, _cx: &mut Context<'_>, buffer: &mut [u8], absolute_position: Size, ) -> Poll<Result<usize>>
fn write( &self, context: &mut Context, _cx: &mut Context<'_>, buffer: &[u8], absolute_position: Size, ) -> Poll<Result<usize>>
fn control( &self, context: &mut Context, _cx: &mut Context<'_>, command: ControlCommandIdentifier, input: &AnyByLayout, output: &mut AnyByLayout, ) -> Poll<Result<()>>
fn clone_context(&self, _context: &Context) -> Result<Context>
fn flush( &self, _context: &mut Context, _cx: &mut Context<'_>, ) -> Poll<Result<(), Kind>>
fn read_until( &self, context: &mut Context, cx: &mut Context<'_>, buffer: &mut [u8], absolute_position: u64, delimiter: &[u8], ) -> Poll<Result<usize, Kind>>
fn write_pattern( &self, context: &mut Context, cx: &mut Context<'_>, pattern: &[u8], count: usize, absolute_position: u64, ) -> Poll<Result<usize, Kind>>
fn write_vectored( &self, context: &mut Context, cx: &mut Context<'_>, buffers: &[&[u8]], absolute_position: u64, ) -> Poll<Result<usize, Kind>>
fn read_sync( &self, context: &mut Context, buffer: &mut [u8], absolute_position: u64, ) -> Result<usize, Kind>
fn write_sync( &self, context: &mut Context, buffer: &[u8], absolute_position: u64, ) -> Result<usize, Kind>
fn flush_sync(&self, context: &mut Context) -> Result<(), Kind>
fn control_sync( &self, context: &mut Context, command: ControlCommandIdentifier, input: &AnyByLayout, output: &mut AnyByLayout, ) -> Result<(), Kind>
fn read_until_sync( &self, context: &mut Context, buffer: &mut [u8], absolute_position: u64, delimiter: &[u8], ) -> Result<usize, Kind>
fn write_pattern_sync( &self, context: &mut Context, pattern: &[u8], count: usize, absolute_position: u64, ) -> Result<usize, Kind>
fn write_vectored_sync( &self, context: &mut Context, buffers: &[&[u8]], absolute_position: u64, ) -> Result<usize, Kind>
§fn cancel_operation(&self, _context: &mut Context, _operation: Operation)
fn cancel_operation(&self, _context: &mut Context, _operation: Operation)
Detach this opening’s registration after completion, error or cancellation.
This hook is idempotent and must not consume data or change the cursor.
Wake and drop retired wakers outside device locks.
fn set_position( &self, _context: &mut Context, current: u64, position: &Position, ) -> Result<u64, Kind>
Source§impl<L: Loader> CharacterDevice for LoaderDevice<L>
impl<L: Loader> CharacterDevice for LoaderDevice<L>
§fn readiness(
&self,
_interests: ReadyEvents,
) -> Result<Option<ReadyEvents>, Kind>
fn readiness( &self, _interests: ReadyEvents, ) -> Result<Option<ReadyEvents>, Kind>
Snapshot device readiness without consuming data. Return
None to use
the VFS fallback, which reports the requested read/write directions
allowed by the opening’s access mode. I/O on such devices may still suspend. Read moreAuto Trait Implementations§
impl<L> Freeze for LoaderDevice<L>where
L: Freeze,
impl<L> RefUnwindSafe for LoaderDevice<L>where
L: RefUnwindSafe,
impl<L> Send for LoaderDevice<L>where
L: Send,
impl<L> Sync for LoaderDevice<L>where
L: Sync,
impl<L> Unpin for LoaderDevice<L>where
L: Unpin,
impl<L> UnsafeUnpin for LoaderDevice<L>where
L: UnsafeUnpin,
impl<L> UnwindSafe for LoaderDevice<L>where
L: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more