commonware_runtime

Trait Network

Source
pub trait Network<L, Si, St>:
    Clone
    + Send
    + Sync
    + 'static
where L: Listener<Si, St>, Si: Sink, St: Stream,
{ // Required methods fn bind( &self, socket: SocketAddr, ) -> impl Future<Output = Result<L, Error>> + Send; fn dial( &self, socket: SocketAddr, ) -> impl Future<Output = Result<(Si, St), Error>> + Send; }
Expand description

Interface that any runtime must implement to create network connections.

Required Methods§

Source

fn bind( &self, socket: SocketAddr, ) -> impl Future<Output = Result<L, Error>> + Send

Bind to the given socket address.

Source

fn dial( &self, socket: SocketAddr, ) -> impl Future<Output = Result<(Si, St), Error>> + Send

Dial the given socket address.

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 Network<Listener, Sink, Stream> for commonware_runtime::deterministic::Context

Source§

impl Network<Listener, Sink, Stream> for commonware_runtime::tokio::Context