pub struct Relay;Expand description
A readable stream handle - can be subscribed to and piped from. A typed, heterogeneous relay with lossless delivery and completion tracking. Relay namespace for creating channels.
Use Relay::channel() to create a new relay channel.
Implementations§
Source§impl Relay
impl Relay
Sourcepub fn channel() -> (RelaySender, RelayReceiver)
pub fn channel() -> (RelaySender, RelayReceiver)
Create a new relay channel with explicit ownership semantics.
Returns (RelaySender, RelayReceiver) where:
RelaySenderis the sole owner (not Clone) - dropping it closes the channelRelayReceivercan be cloned for multiple subscribers- Use
tx.weak()to get aWeakSenderfor sending without ownership
This is the recommended way to create relays as it enforces clear lifecycle ownership.
Sourcepub fn channel_with_size(channel_size: usize) -> (RelaySender, RelayReceiver)
pub fn channel_with_size(channel_size: usize) -> (RelaySender, RelayReceiver)
Create a relay channel with custom buffer size.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Relay
impl RefUnwindSafe for Relay
impl Send for Relay
impl Sync for Relay
impl Unpin for Relay
impl UnwindSafe for Relay
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