pub trait Transport {
// Required methods
fn send(&mut self, message: &[u8]) -> Result<(), TransportError>;
fn receive(&mut self) -> Result<Vec<u8>, TransportError>;
fn binding(&self) -> [u8; 32];
fn own_endpoint(&self) -> [u8; 32];
fn peer_endpoint(&self) -> [u8; 32];
// Provided method
fn has_message(&mut self) -> bool { ... }
}Expand description
A connection between two replicas, which carries whole messages in order, and is encrypted and bound to the two endpoints’ keys (Sync).
Required Methods§
Sourcefn receive(&mut self) -> Result<Vec<u8>, TransportError>
fn receive(&mut self) -> Result<Vec<u8>, TransportError>
Waits for the next message.
§Errors
Returns an error if the connection fails or closes, or the message is longer than
MAX_MESSAGE_LEN.
Sourcefn binding(&self) -> [u8; 32]
fn binding(&self) -> [u8; 32]
The 32 bytes exported from the connection’s encryption, the same on both sides of this connection and on no other.
Sourcefn own_endpoint(&self) -> [u8; 32]
fn own_endpoint(&self) -> [u8; 32]
This side’s endpoint ID.
Sourcefn peer_endpoint(&self) -> [u8; 32]
fn peer_endpoint(&self) -> [u8; 32]
The other side’s endpoint ID, as the connection proved it.
Provided Methods§
Sourcefn has_message(&mut self) -> bool
fn has_message(&mut self) -> bool
Whether Transport::receive would return at once: the next message has arrived, or
the connection failed. A transport that cannot tell says no, which costs only speed:
a replica saves what it received before it waits (Holder::pause).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".