pub struct Incoming<M> {
pub id: MsgId,
pub sender: PartyIndex,
pub msg_type: MessageType,
pub msg: M,
}
Expand description
Incoming message
Fields§
§id: MsgId
Index of a message
sender: PartyIndex
Index of a party who sent the message
msg_type: MessageType
Indicates whether it’s a broadcast message (meaning that this message is received by all the
parties), or p2p (private message sent by sender
)
msg: M
Received message
Implementations§
Source§impl<M> Incoming<M>
impl<M> Incoming<M>
Sourcepub fn map<T, F>(self, f: F) -> Incoming<T>where
F: FnOnce(M) -> T,
pub fn map<T, F>(self, f: F) -> Incoming<T>where
F: FnOnce(M) -> T,
Maps Incoming<M>
to Incoming<T>
by applying a function to the message body
Sourcepub fn try_map<T, E, F>(self, f: F) -> Result<Incoming<T>, E>
pub fn try_map<T, E, F>(self, f: F) -> Result<Incoming<T>, E>
Maps Incoming<M>
to Result<Incoming<T>, E>
by applying a function fn(M) -> Result<T, E>
to the message body
Sourcepub fn is_broadcast(&self) -> bool
pub fn is_broadcast(&self) -> bool
Checks whether it’s broadcast message
Trait Implementations§
impl<M: Copy> Copy for Incoming<M>
impl<M: Eq> Eq for Incoming<M>
impl<M> StructuralPartialEq for Incoming<M>
Auto Trait Implementations§
impl<M> Freeze for Incoming<M>where
M: Freeze,
impl<M> RefUnwindSafe for Incoming<M>where
M: RefUnwindSafe,
impl<M> Send for Incoming<M>where
M: Send,
impl<M> Sync for Incoming<M>where
M: Sync,
impl<M> Unpin for Incoming<M>where
M: Unpin,
impl<M> UnwindSafe for Incoming<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