Struct round_based::Outgoing
source · pub struct Outgoing<M> {
pub recipient: MessageDestination,
pub msg: M,
}
Expand description
Outgoing message
Fields§
§recipient: MessageDestination
Message destination: either one party (p2p message) or all parties (broadcast message)
msg: M
Message being sent
Implementations§
source§impl<M> Outgoing<M>
impl<M> Outgoing<M>
sourcepub fn p2p(recipient: PartyIndex, msg: M) -> Self
pub fn p2p(recipient: PartyIndex, msg: M) -> Self
Constructs an outgoing message addressed to one party
sourcepub fn map<M2, F>(self, f: F) -> Outgoing<M2>where
F: FnOnce(M) -> M2,
pub fn map<M2, F>(self, f: F) -> Outgoing<M2>where
F: FnOnce(M) -> M2,
Maps Outgoing<M>
to Outgoing<M2>
by applying a function to the message body
sourcepub fn is_broadcast(&self) -> bool
pub fn is_broadcast(&self) -> bool
Checks whether it’s broadcast message
Trait Implementations§
source§impl<M: PartialEq> PartialEq for Outgoing<M>
impl<M: PartialEq> PartialEq for Outgoing<M>
source§impl<M> Sink<Outgoing<M>> for MockedOutgoing<M>
Available on crate feature dev
only.
impl<M> Sink<Outgoing<M>> for MockedOutgoing<M>
Available on crate feature
dev
only.source§fn poll_ready(
self: Pin<&mut Self>,
_cx: &mut Context<'_>
) -> Poll<Result<(), Self::Error>>
fn poll_ready( self: Pin<&mut Self>, _cx: &mut Context<'_> ) -> Poll<Result<(), Self::Error>>
Attempts to prepare the
Sink
to receive a value. Read moresource§fn start_send(self: Pin<&mut Self>, msg: Outgoing<M>) -> Result<(), Self::Error>
fn start_send(self: Pin<&mut Self>, msg: Outgoing<M>) -> Result<(), Self::Error>
Begin the process of sending a value to the sink.
Each call to this function must be preceded by a successful call to
poll_ready
which returned Poll::Ready(Ok(()))
. Read moresource§impl<M> Sink<Outgoing<M>> for Outgoings<M>
Available on crate feature state-machine
only.
impl<M> Sink<Outgoing<M>> for Outgoings<M>
Available on crate feature
state-machine
only.source§fn poll_ready(
self: Pin<&mut Self>,
_cx: &mut Context<'_>
) -> Poll<Result<(), Self::Error>>
fn poll_ready( self: Pin<&mut Self>, _cx: &mut Context<'_> ) -> Poll<Result<(), Self::Error>>
Attempts to prepare the
Sink
to receive a value. Read moresource§fn start_send(self: Pin<&mut Self>, msg: Outgoing<M>) -> Result<(), Self::Error>
fn start_send(self: Pin<&mut Self>, msg: Outgoing<M>) -> Result<(), Self::Error>
Begin the process of sending a value to the sink.
Each call to this function must be preceded by a successful call to
poll_ready
which returned Poll::Ready(Ok(()))
. Read moreimpl<M: Copy> Copy for Outgoing<M>
impl<M> StructuralPartialEq for Outgoing<M>
Auto Trait Implementations§
impl<M> Freeze for Outgoing<M>where
M: Freeze,
impl<M> RefUnwindSafe for Outgoing<M>where
M: RefUnwindSafe,
impl<M> Send for Outgoing<M>where
M: Send,
impl<M> Sync for Outgoing<M>where
M: Sync,
impl<M> Unpin for Outgoing<M>where
M: Unpin,
impl<M> UnwindSafe for Outgoing<M>where
M: UnwindSafe,
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