pub trait NetworkProvider:
Clone
+ Send
+ Sync
+ 'static {
type TcpStream: AsyncRead + AsyncWrite + Unpin + Send + 'static;
type TcpListener: TcpListenerTrait<TcpStream = Self::TcpStream> + 'static;
// Required methods
fn bind(
&self,
addr: &str,
) -> impl Future<Output = Result<Self::TcpListener>> + Send;
fn connect(
&self,
addr: &str,
) -> impl Future<Output = Result<Self::TcpStream>> + Send;
}Expand description
Provider trait for creating network connections and listeners.
Clone allows sharing providers across multiple peers efficiently.
Required Associated Types§
Sourcetype TcpStream: AsyncRead + AsyncWrite + Unpin + Send + 'static
type TcpStream: AsyncRead + AsyncWrite + Unpin + Send + 'static
The TCP stream type for this provider.
Sourcetype TcpListener: TcpListenerTrait<TcpStream = Self::TcpStream> + 'static
type TcpListener: TcpListenerTrait<TcpStream = Self::TcpStream> + 'static
The TCP listener type for this provider.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
Source§impl NetworkProvider for TokioNetworkProvider
Available on crate feature tokio-providers only.
impl NetworkProvider for TokioNetworkProvider
Available on crate feature
tokio-providers only.