pub struct TcpBridge { /* private fields */ }Implementations§
source§impl TcpBridge
impl TcpBridge
constructors
sourcepub async fn accepting_from(port: u16) -> TcpBridge
pub async fn accepting_from(port: u16) -> TcpBridge
Creates a listening TcpBridge which accepts connections to port
Cancel safety
This method is to be assumed not cancel safe.
The cancel safety of this method cannot be garanteed since the underlying
bind future does not make any statements about cancel safety
source§impl TcpBridge
impl TcpBridge
extract logic
sourcepub async fn extract<'a>(&mut self, buf: &'a mut [u8]) -> Action<'a>
pub async fn extract<'a>(&mut self, buf: &'a mut [u8]) -> Action<'a>
Wait for an action to occur which can the transfered to the other half of this Bridge
Cancel safety
This method is cancel safe. After a returning action has been selected all internal futures will be dropped. Underlying futures are all cancel safe, hence this function may be used in tokio::select
source§impl TcpBridge
impl TcpBridge
input logic
sourcepub async fn input<'a>(&mut self, action: Action<'a>) -> Action<'_>
pub async fn input<'a>(&mut self, action: Action<'a>) -> Action<'_>
Inputs an action produced by the other half of this Bridge
Cancel safety
This method is not cancellation safe.
If it is used as the event in a tokio::select statement and
some other branch completes first, then the provided action may
have been partially executed, but future calls to input will
start over with the action