pub struct Outbox<T> { /* private fields */ }Expand description
Posts messages into a channel.
Cheap to share: several producers may hold a clone, and send takes &self
so no producer needs unique access to post work.
Implementations§
Source§impl<T: Send + 'static> Outbox<T>
impl<T: Send + 'static> Outbox<T>
Sourcepub fn of<P: Produce<T> + Send + Sync + 'static>(producer: P) -> Self
pub fn of<P: Produce<T> + Send + Sync + 'static>(producer: P) -> Self
Wraps a transport-specific producer.
Transports build ends through this; everyone else gets them from
Transport::channel.
Sourcepub fn send(&self, message: T) -> Result<(), Undeliverable<T>>
pub fn send(&self, message: T) -> Result<(), Undeliverable<T>>
Posts message, or hands it back if no consumer remains.
Closing is reported by the send failing, so a producer learns about it without a separate query.
Trait Implementations§
Auto Trait Implementations§
impl<T> !RefUnwindSafe for Outbox<T>
impl<T> !UnwindSafe for Outbox<T>
impl<T> Freeze for Outbox<T>
impl<T> Send for Outbox<T>
impl<T> Sync for Outbox<T>
impl<T> Unpin for Outbox<T>
impl<T> UnsafeUnpin for Outbox<T>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more