Skip to main content

Handler

Trait Handler 

Source
pub trait Handler {
    // Required methods
    fn completed(&mut self, id: usize, flags: u32, result: Result<usize>);
    fn canceled(&mut self, id: usize);
    fn tick(&mut self);
    fn cleanup(&mut self);

    // Provided methods
    fn in_flight(&self) -> usize { ... }
    fn abandon(&mut self) { ... }
}

Required Methods§

Source

fn completed(&mut self, id: usize, flags: u32, result: Result<usize>)

Operation is completed.

Source

fn canceled(&mut self, id: usize)

Operation is canceled.

Source

fn tick(&mut self)

The driver’s turn has completed.

Source

fn cleanup(&mut self)

Clean up the handle before dropping the driver.

Called on shutdown, after the operations counted by in_flight completed.

Provided Methods§

Source

fn in_flight(&self) -> usize

Number of submitted operations without their final completion.

The driver waits for them on shutdown, see cleanup.

Source

fn abandon(&mut self)

Operations are still in flight when the driver stops.

Called instead of cleanup. The handler is leaked afterwards, so memory referenced by the operations stays valid. It must not release anything the kernel may still use. Descriptors may be closed, the shutdown flushed every submission and the kernel holds its own file reference for each issued operation.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§