pub trait Network {
// Required methods
fn send<'life0, 'async_trait>(
&'life0 mut self,
source: i32,
msg: String,
) -> Pin<Box<dyn Future<Output = NetworkResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn receive<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = NetworkResult<NetworkUpdate>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
This trait represent a network that will be used to send and receive messages
Required Methods§
Sourcefn send<'life0, 'async_trait>(
&'life0 mut self,
source: i32,
msg: String,
) -> Pin<Box<dyn Future<Output = NetworkResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send<'life0, 'async_trait>(
&'life0 mut self,
source: i32,
msg: String,
) -> Pin<Box<dyn Future<Output = NetworkResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn receive<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = NetworkResult<NetworkUpdate>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn receive<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = NetworkResult<NetworkUpdate>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Receive a message from the network
§Returns
Ok(NetworkUpdate)
- If a message has been receivedErr(e)
- If an error occurred