Skip to main content

AsyncEvidence

Trait AsyncEvidence 

Source
pub trait AsyncEvidence {
    type Proof;
    type Error;

    // Required methods
    fn committed(
        &mut self,
    ) -> impl Future<Output = Result<bool, Self::Error>> + Send;
    fn probe(
        &mut self,
    ) -> impl Future<Output = Result<Option<Self::Proof>, Self::Error>> + Send;

    // Provided method
    fn wait(&mut self, until: Instant) -> impl Future<Output = ()> + Send { ... }
}
Expand description

Evidence about a candidate, gathered on a Tokio runtime.

Required Associated Types§

Source

type Proof

A verified response from the candidate.

Source

type Error

Application, transport or record failure. It ends the wait.

Required Methods§

Source

fn committed( &mut self, ) -> impl Future<Output = Result<bool, Self::Error>> + Send

Whether the published selection names the candidate. Read before each probe; a record is never treated as a proof.

Source

fn probe( &mut self, ) -> impl Future<Output = Result<Option<Self::Proof>, Self::Error>> + Send

A fresh proof from the candidate, or None. The caller also enforces the round’s deadline with a timeout, so pending I/O must tolerate cancellation.

Provided Methods§

Source

fn wait(&mut self, until: Instant) -> impl Future<Output = ()> + Send

Wait until the next round is worth making, but not past until.

The default sleeps for POLL_INTERVAL. A source that can be woken completes as soon as it has news.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<E> AsyncEvidence for Signaled<E>
where E: AsyncEvidence + Send, E::Proof: Send, E::Error: Send,

Available on crate feature async only.