pub struct SendFlushOnDrop<T>where
T: Transport,{
pub inner: T,
/* private fields */
}
Available on crate features
blocking-client
or async-client
only.Expand description
A utility to automatically send a flush packet when the instance is dropped, assuring a graceful termination of any interaction with the server.
Fields§
§inner: T
The actual transport instance.
Implementations§
Source§impl<T> SendFlushOnDrop<T>where
T: Transport,
impl<T> SendFlushOnDrop<T>where
T: Transport,
Sourcepub fn new(transport: T, trace_packetlines: bool) -> Self
pub fn new(transport: T, trace_packetlines: bool) -> Self
Create a new instance with transport
, while optionally tracing packetlines with trace_packetlines
.
Sourcepub fn indicate_end_of_interaction(&mut self) -> Result<(), Error>
pub fn indicate_end_of_interaction(&mut self) -> Result<(), Error>
Useful to explicitly invalidate the connection by sending a flush-packet. This will happen exactly once, and it is not considered an error to call it multiple times.
For convenience, this is not consuming, but could be to assure the underlying transport isn’t used anymore.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for SendFlushOnDrop<T>where
T: Freeze,
impl<T> RefUnwindSafe for SendFlushOnDrop<T>where
T: RefUnwindSafe,
impl<T> Send for SendFlushOnDrop<T>where
T: Send,
impl<T> Sync for SendFlushOnDrop<T>where
T: Sync,
impl<T> Unpin for SendFlushOnDrop<T>where
T: Unpin,
impl<T> UnwindSafe for SendFlushOnDrop<T>where
T: UnwindSafe,
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