Trait Transport
Source pub trait Transport:
AsTransport
+ Send
+ Sync {
// Required methods
fn input_state(&self, port: InputPortID) -> Result<PortState, PortError>;
fn output_state(&self, port: OutputPortID) -> Result<PortState, PortError>;
fn open_input(&self) -> Result<InputPortID, PortError>;
fn open_output(&self) -> Result<OutputPortID, PortError>;
fn close_input(&self, input: InputPortID) -> Result<bool, PortError>;
fn close_output(&self, output: OutputPortID) -> Result<bool, PortError>;
fn connect(
&self,
source: OutputPortID,
target: InputPortID,
) -> Result<bool, PortError>;
fn send(
&self,
output: OutputPortID,
message: Bytes,
) -> Result<(), PortError>;
fn recv(&self, input: InputPortID) -> Result<Option<Bytes>, PortError>;
fn try_recv(&self, input: InputPortID) -> Result<Option<Bytes>, PortError>;
// Provided methods
fn state(&self, port: PortID) -> Result<PortState, PortError> { ... }
fn close(&self, port: PortID) -> Result<bool, PortError> { ... }
}