Skip to main content

Pollable

Trait Pollable 

Source
pub trait Pollable {
    // Required method
    fn poll(&self) -> Poll<Result<Option<Vec<u8>>, String>>;
}
Expand description

A handle for a long-running operation that can be polled for completion.

This is used primarily by the INVOK operation. Since PK Command is designed for poll-based environments (like in embedded systems, or within an async runtime), methods that take time to execute should return a Pollable.

The state machine will call poll() periodically and send AWAIT packets to the host to keep the transaction alive as long as Poll::Pending is returned.

Required Methods§

Source

fn poll(&self) -> Poll<Result<Option<Vec<u8>>, String>>

Polls the operation for completion.

§Returns
  • Poll::Ready(Ok(Some(data))): Operation finished with result data.
  • Poll::Ready(Ok(None)): Operation finished successfully with no data.
  • Poll::Ready(Err(e)): Operation failed with an error message.
  • Poll::Pending: Operation is still in progress.

Implementors§

Source§

impl Pollable for EmbassyPollable

Available on crate feature embassy-runtime only.
Source§

impl Pollable for SmolFuturePollable

Available on crate features std and smol-runtime only.
Source§

impl Pollable for PkPromise

Available on crate feature std only.
Source§

impl Pollable for TokioFuturePollable

Available on crate features std and tokio-runtime only.