pub struct Mailbox<P: PublicKey, M: Digestible + Codec> { /* private fields */ }Expand description
Ingress mailbox for super::Engine.
Implementations§
Source§impl<P: PublicKey, M: Digestible + Codec> Mailbox<P, M>
impl<P: PublicKey, M: Digestible + Codec> Mailbox<P, M>
Sourcepub fn subscribe(&self, digest: M::Digest) -> Receiver<Arc<M>>
pub fn subscribe(&self, digest: M::Digest) -> Receiver<Arc<M>>
Subscribe to a message by digest.
The responder will be sent the message when it is available; either instantly (if cached) or when it is received from the network. The request can be canceled by dropping the responder.
If the engine has shut down, the returned receiver will resolve to Canceled.
Sourcepub async fn get(&self, digest: M::Digest) -> Option<Arc<M>>
pub async fn get(&self, digest: M::Digest) -> Option<Arc<M>>
Get a message by digest.
If the engine has shut down, returns None.
Broadcast a shared message to recipients.
If the engine has shut down, returns Feedback::Closed.
Trait Implementations§
Source§impl<P: PublicKey, M: Digestible + Codec> Broadcaster for Mailbox<P, M>
impl<P: PublicKey, M: Digestible + Codec> Broadcaster for Mailbox<P, M>
Source§fn broadcast(
&self,
recipients: Self::Recipients,
message: Self::Message,
) -> Feedback
fn broadcast( &self, recipients: Self::Recipients, message: Self::Message, ) -> Feedback
Broadcast a message to recipients.
If the engine has shut down, returns Feedback::Closed.
Source§type Recipients = Recipients<P>
type Recipients = Recipients<P>
The type of recipients that can receive messages.
Auto Trait Implementations§
impl<P, M> !RefUnwindSafe for Mailbox<P, M>
impl<P, M> !UnwindSafe for Mailbox<P, M>
impl<P, M> Freeze for Mailbox<P, M>
impl<P, M> Send for Mailbox<P, M>
impl<P, M> Sync for Mailbox<P, M>
impl<P, M> Unpin for Mailbox<P, M>
impl<P, M> UnsafeUnpin for Mailbox<P, M>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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