Skip to main content

RunWithConnectionTo

Trait RunWithConnectionTo 

Source
pub trait RunWithConnectionTo<Counterpart: Role>: Send {
    // Required method
    fn run_with_connection_to(
        self,
        cx: ConnectionTo<Counterpart>,
    ) -> impl Future<Output = Result<(), Error>> + Send;
}
Expand description

A background task that runs alongside a connection.

RunIn<R> means “run in the context of being role R”. The task receives a ConnectionTo<R::Counterpart> for communicating with the other side.

Implementations are composed using ChainRun and run in parallel when the connection is active.

Required Methods§

Source

fn run_with_connection_to( self, cx: ConnectionTo<Counterpart>, ) -> impl Future<Output = Result<(), Error>> + Send

Run this task to completion.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<Counterpart: Role> RunWithConnectionTo<Counterpart> for NullRun

Source§

impl<Counterpart: Role, A, B> RunWithConnectionTo<Counterpart> for ChainRun<A, B>
where A: RunWithConnectionTo<Counterpart>, B: RunWithConnectionTo<Counterpart>,