pub struct Message<T> {
pub msg_id: usize,
pub sender_id: usize,
pub target_id: usize,
pub msg: T,
}Expand description
A message that can sent between nodes for communication. The message
is generic for type T
Fields§
§msg_id: usizeThe id of this message
sender_id: usizeThe id of the sender
target_id: usizeThe id of the node this message is being sent to
msg: TThe body of the message
Implementations§
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Message<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Message<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T: Serialize> Encoder<Message<T>> for MessageCodec<T>
impl<T: Serialize> Encoder<Message<T>> for MessageCodec<T>
Source§fn encode(
&mut self,
item: Message<T>,
dst: &mut BytesMut,
) -> Result<(), Self::Error>
fn encode( &mut self, item: Message<T>, dst: &mut BytesMut, ) -> Result<(), Self::Error>
Encodes a message by writing the length of the serialized message at the start of a frame, and then writing that many bytes into a buffer to be sent.
Source§type Error = LiquidError
type Error = LiquidError
The type of encoding errors. Read more
Auto Trait Implementations§
impl<T> Freeze for Message<T>where
T: Freeze,
impl<T> RefUnwindSafe for Message<T>where
T: RefUnwindSafe,
impl<T> Send for Message<T>where
T: Send,
impl<T> Sync for Message<T>where
T: Sync,
impl<T> Unpin for Message<T>where
T: Unpin,
impl<T> UnwindSafe for Message<T>where
T: 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
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