pub struct Connection<'b, S, TX, TS, D = NoDelay> { /* private fields */ }Expand description
An active Modbus TCP → RTU bridge connection.
Returned by Bridge::accept. Mutably borrows the
bridge for its lifetime, preventing a second connection from being accepted
until this one is finished.
Drive the connection by calling next in a loop.
Implementations§
Source§impl<'b, S, TX, TS, D> Connection<'b, S, TX, TS, D>
impl<'b, S, TX, TS, D> Connection<'b, S, TX, TS, D>
Sourcepub fn into_stream(self) -> TS
pub fn into_stream(self) -> TS
Source§impl<S, TX, TS> Connection<'_, S, TX, TS, NoDelay>
impl<S, TX, TS> Connection<'_, S, TX, TS, NoDelay>
Sourcepub async fn next(
&mut self,
) -> Result<BridgeEvent, BridgeError<S::Error, TS::Error>>
pub async fn next( &mut self, ) -> Result<BridgeEvent, BridgeError<S::Error, TS::Error>>
Drives one complete Modbus request/response cycle asynchronously.
§Errors
Returns BridgeError::TcpClosed when the
TCP client closes the connection cleanly.
Source§impl<S, TX, TS, D> Connection<'_, S, TX, TS, D>
impl<S, TX, TS, D> Connection<'_, S, TX, TS, D>
Sourcepub async fn next(
&mut self,
) -> Result<BridgeEvent, BridgeError<S::Error, TS::Error>>
pub async fn next( &mut self, ) -> Result<BridgeEvent, BridgeError<S::Error, TS::Error>>
Drives one complete Modbus request/response cycle asynchronously, with timeouts.
Applies tcp_timeout_ms around reading the incoming TCP request and
rtu_timeout_ms around the RTU send+receive cycle.
§Errors
Returns BridgeError::Timeout if a deadline expires.
Auto Trait Implementations§
impl<'b, S, TX, TS, D> Freeze for Connection<'b, S, TX, TS, D>where
TS: Freeze,
impl<'b, S, TX, TS, D> RefUnwindSafe for Connection<'b, S, TX, TS, D>
impl<'b, S, TX, TS, D> Send for Connection<'b, S, TX, TS, D>
impl<'b, S, TX, TS, D> Sync for Connection<'b, S, TX, TS, D>
impl<'b, S, TX, TS, D> Unpin for Connection<'b, S, TX, TS, D>where
TS: Unpin,
impl<'b, S, TX, TS, D> UnsafeUnpin for Connection<'b, S, TX, TS, D>where
TS: UnsafeUnpin,
impl<'b, S, TX, TS, D = NoDelay> !UnwindSafe for Connection<'b, S, TX, TS, D>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more