Skip to main content

Channel

Trait Channel 

Source
pub trait Channel {
    // Required methods
    fn boxed(self) -> Box<dyn Channel + Send>
       where Self: Sized;
    fn disconnect_by_ref(&self) -> Result<(), TryLockError>;

    // Provided method
    fn disconnect(self) -> Result<(), DisconnectError<Self>>
       where Self: Sized { ... }
}
Expand description

Common functionality for all channel types

Required Methods§

Source

fn boxed(self) -> Box<dyn Channel + Send>
where Self: Sized,

Gives a type erased version of this channel

Source

fn disconnect_by_ref(&self) -> Result<(), TryLockError>

Disconnects this channel without consuming it

§Usage Note

A channel is useless after being disconnected, so it is recommended to use disconnect where possible instead.

§Note

Disconnecting channels requires the mutex if all involved components to be locked, and can thus interfere with execution or even lead to deadlocks.

It is recommended to only attempt to disconnect channels from components that are paused or killed.

Provided Methods§

Source

fn disconnect(self) -> Result<(), DisconnectError<Self>>
where Self: Sized,

Disconnects this channel

§Note

Disconnecting channels requires the mutex if all involved components to be locked, and can thus interfere with execution or even lead to deadlocks.

It is recommended to only attempt to disconnect channels from components that are paused or killed.

Trait Implementations§

Source§

impl Channel for Box<dyn Channel + Send>

Source§

fn boxed(self) -> Box<dyn Channel + Send>

Gives a type erased version of this channel
Source§

fn disconnect_by_ref(&self) -> Result<(), TryLockError>

Disconnects this channel without consuming it Read more
Source§

fn disconnect(self) -> Result<(), DisconnectError<Self>>
where Self: Sized,

Disconnects this channel Read more

Implementations on Foreign Types§

Source§

impl Channel for Box<dyn Channel + Send>

Implementors§

Source§

impl<P, C1, C2> Channel for TwoWayChannel<P, C1, C2>
where P: Port + 'static, C1: ComponentDefinition + 'static + Provide<P> + ProvideRef<P>, C2: ComponentDefinition + 'static + Require<P> + RequireRef<P>,

Source§

impl<P, C> Channel for ProviderChannel<P, C>
where P: Port + 'static, C: ComponentDefinition + 'static + Provide<P> + ProvideRef<P>,

Source§

impl<P, C> Channel for RequirerChannel<P, C>
where P: Port + 'static, C: ComponentDefinition + 'static + Require<P> + RequireRef<P>,