Added node comms
This commit is contained in:
17
node/src/comms.rs
Normal file
17
node/src/comms.rs
Normal file
@ -0,0 +1,17 @@
|
||||
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;
|
Reference in New Issue
Block a user