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§
Sourcefn boxed(self) -> Box<dyn Channel + Send>where
Self: Sized,
fn boxed(self) -> Box<dyn Channel + Send>where
Self: Sized,
Gives a type erased version of this channel
Sourcefn disconnect_by_ref(&self) -> Result<(), TryLockError>
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§
Sourcefn disconnect(self) -> Result<(), DisconnectError<Self>>where
Self: Sized,
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.