pub struct Mailbox<P: PublicKey, M: Committable + Digestible + Codec> { /* private fields */ }Expand description
Ingress mailbox for super::Engine.
Implementations§
Source§impl<P: PublicKey, M: Committable + Digestible + Codec> Mailbox<P, M>
impl<P: PublicKey, M: Committable + Digestible + Codec> Mailbox<P, M>
Sourcepub async fn subscribe(
&mut self,
peer: Option<P>,
commitment: M::Commitment,
digest: Option<M::Digest>,
) -> Receiver<M>
pub async fn subscribe( &mut self, peer: Option<P>, commitment: M::Commitment, digest: Option<M::Digest>, ) -> Receiver<M>
Subscribe to a message by peer (optionally), commitment, and digest (optionally).
The responder will be sent the first message for an commitment 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 subscribe_prepared(
&mut self,
peer: Option<P>,
commitment: M::Commitment,
digest: Option<M::Digest>,
responder: Sender<M>,
)
pub async fn subscribe_prepared( &mut self, peer: Option<P>, commitment: M::Commitment, digest: Option<M::Digest>, responder: Sender<M>, )
Subscribe to a message by peer (optionally), commitment, and digest (optionally) with an externally prepared responder.
The responder will be sent the first message for an commitment 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, this is a no-op.
Trait Implementations§
Source§impl<P: PublicKey, M: Committable + Digestible + Codec> Broadcaster for Mailbox<P, M>
impl<P: PublicKey, M: Committable + Digestible + Codec> Broadcaster for Mailbox<P, M>
Source§async fn broadcast(
&mut self,
recipients: Self::Recipients,
message: Self::Message,
) -> Receiver<Self::Response>
async fn broadcast( &mut self, recipients: Self::Recipients, message: Self::Message, ) -> Receiver<Self::Response>
Broadcast a message to recipients.
If the engine has shut down, the returned receiver will resolve to Canceled.
Source§type Recipients = Recipients<P>
type Recipients = Recipients<P>
Auto Trait Implementations§
impl<P, M> Freeze for Mailbox<P, M>
impl<P, M> !RefUnwindSafe 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> !UnwindSafe 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
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>
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>
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>
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