17 lines
649 B
Rust
17 lines
649 B
Rust
pub trait Sender {
|
|
async fn send(&mut self, msg: &[u8]) -> Result<(), Reset>;
|
|
}
|
|
|
|
pub trait Receiver {
|
|
async fn receive(&mut self, buffer: &mut [u8]) -> Result<(), Reset>;
|
|
}
|
|
|
|
//TODO: Replace with !
|
|
pub struct Never;
|
|
|
|
/// Communication errors indicates either:
|
|
/// Our connection was already disconnected, in which case we should reset and wait for new connection to made.
|
|
/// or
|
|
/// There was an unexpected, irrecoverable error in communication, in which case we don't want to enter a terminal error
|
|
/// safe mode, because there is no indication the actual control is broken, so all we can really do is reset the connection.
|
|
pub struct Reset; |