iroh_gossip::proto::topic

Trait IO

Source
pub trait IO<PI: Clone> {
    // Required method
    fn push(&mut self, event: impl Into<OutEvent<PI>>);

    // Provided method
    fn push_from_iter(
        &mut self,
        iter: impl IntoIterator<Item = impl Into<OutEvent<PI>>>,
    ) { ... }
}
Expand description

A trait for a concrete type to push OutEvents to.

The implementation is generic over this trait, which allows the upper layer to supply a container of their choice for OutEvents emitted from the protocol state.

Required Methods§

Source

fn push(&mut self, event: impl Into<OutEvent<PI>>)

Push an event in the IO container

Provided Methods§

Source

fn push_from_iter( &mut self, iter: impl IntoIterator<Item = impl Into<OutEvent<PI>>>, )

Push all events from an iterator into the IO container

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.

Implementations on Foreign Types§

Source§

impl<PI: Clone> IO<PI> for VecDeque<OutEvent<PI>>

Source§

fn push(&mut self, event: impl Into<OutEvent<PI>>)

Implementors§