pub struct Control<P, R> { /* private fields */ }
Expand description
Control signals for the running outgoing channel, allowing the rest of the program to register new sessions and to abort all ongoing ones.
Implementations§
Source§impl<P, R> Control<P, R>
impl<P, R> Control<P, R>
Sourcepub fn add(&self, protocol_id: P, tx: Sender<R>, rx: Receiver<R>) -> bool
pub fn add(&self, protocol_id: P, tx: Sender<R>, rx: Receiver<R>) -> bool
Register the client side of a session protocol, so that run
starts listening
to messages coming from the protocol and multiplexing them to the outgoing
connection towards the server, and also starts dispaching server messages
to this protocol.
The session should be automatically removed when it closes the other sides of the channels.
Returns false
if the channel is already closed and the session could not be registered.
Sourcepub fn error(&self, _protocol_id: P, error: SessionError)
pub fn error(&self, _protocol_id: P, error: SessionError)
Remove all sessions due to protocol violation. Use an internal channel to notify run
.
Auto Trait Implementations§
impl<P, R> Freeze for Control<P, R>
impl<P, R> RefUnwindSafe for Control<P, R>
impl<P, R> Send for Control<P, R>
impl<P, R> Sync for Control<P, R>
impl<P, R> Unpin for Control<P, R>
impl<P, R> UnwindSafe for Control<P, R>
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