Skip to main content

CompletionPort

Trait CompletionPort 

Source
pub trait CompletionPort {
    type Error;

    // Required methods
    fn query(&mut self) -> Result<bool, Self::Error>;
    async fn block(&mut self) -> Result<(), Self::Error>;
    async fn poll(&mut self) -> Result<(), Self::Error>;
    fn arm(&mut self) -> Result<(), Self::Error>;
    async fn park(&mut self, bound: DurNs) -> Result<bool, Self::Error>;
}
Expand description

One wait on device work, implemented per backend (the core names no vendor). query answers at once; the others take time and are awaited: a host that runs them on the waiting thread returns a ready future, an executor’s pend. Errors are the port’s own type and pass through wait unchanged.

Required Associated Types§

Source

type Error

The backend’s error.

Required Methods§

Source

fn query(&mut self) -> Result<bool, Self::Error>

The status: Ok(true) done, Ok(false) pending; Err = the work failed.

§Errors

The device reports a failure.

Source

async fn block(&mut self) -> Result<(), Self::Error>

Park::Block: the vendor’s own blocking wait.

§Errors

The device reports a failure.

Source

async fn poll(&mut self) -> Result<(), Self::Error>

Park::QueryPoll and the tail of Park::FlagWait: query until done.

§Errors

The device reports a failure.

Source

fn arm(&mut self) -> Result<(), Self::Error>

Park::FlagWait: enqueue the completion word’s write behind the pending work.

§Errors

The enqueue fails.

Source

async fn park(&mut self, bound: DurNs) -> Result<bool, Self::Error>

Park::FlagWait: park on the armed word for at most bound; Ok(true) once the word has been written. May return Ok(false) early (a spurious wake).

§Errors

The park itself fails (never the device status: that is query’s).

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl CompletionPort for CudaPort<'_>

Available on crate feature cuda only.