Struct Control

Source
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>

Source

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.

Source

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>
where P: Send, R: Send,

§

impl<P, R> Sync for Control<P, R>
where P: Send, R: Send,

§

impl<P, R> Unpin for Control<P, R>

§

impl<P, R> UnwindSafe for Control<P, R>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.