pub struct NetworkMessage<T: NetworkContent> {
pub to: Arc<String>,
pub from: Arc<String>,
pub id: Arc<String>,
pub reply: Option<Arc<String>>,
pub content: T,
}
Expand description
This struct represents the network messages sent and received, it can be created either from
the new new
constructor if a fresh message is desired.
If a reply is desired then the reply
method should be used.
Fields§
§to: Arc<String>
The receiver id, this is currently a string but this may change to a generic representing an id in the future
from: Arc<String>
The sender id, this is currently a string but this may change to a generic representing an id in the future
id: Arc<String>
The message id, used to reply to this message
reply: Option<Arc<String>>
If this is set to Some
then this message is a reply to the contained ID, else it is a
fresh message
content: T
The content of the message
Implementations§
Trait Implementations§
Source§impl<T: Clone + NetworkContent> Clone for NetworkMessage<T>
impl<T: Clone + NetworkContent> Clone for NetworkMessage<T>
Source§fn clone(&self) -> NetworkMessage<T>
fn clone(&self) -> NetworkMessage<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T: Debug + NetworkContent> Debug for NetworkMessage<T>
impl<T: Debug + NetworkContent> Debug for NetworkMessage<T>
Source§impl<'de, T> Deserialize<'de> for NetworkMessage<T>where
T: DeserializeOwned + NetworkContent,
impl<'de, T> Deserialize<'de> for NetworkMessage<T>where
T: DeserializeOwned + NetworkContent,
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: Hash + NetworkContent> Hash for NetworkMessage<T>
impl<T: Hash + NetworkContent> Hash for NetworkMessage<T>
Source§impl<T: Ord + NetworkContent> Ord for NetworkMessage<T>
impl<T: Ord + NetworkContent> Ord for NetworkMessage<T>
Source§fn cmp(&self, other: &NetworkMessage<T>) -> Ordering
fn cmp(&self, other: &NetworkMessage<T>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: PartialEq + NetworkContent> PartialEq for NetworkMessage<T>
impl<T: PartialEq + NetworkContent> PartialEq for NetworkMessage<T>
Source§impl<T: PartialOrd + NetworkContent> PartialOrd for NetworkMessage<T>
impl<T: PartialOrd + NetworkContent> PartialOrd for NetworkMessage<T>
Source§impl<T> Serialize for NetworkMessage<T>where
T: Serialize + NetworkContent,
impl<T> Serialize for NetworkMessage<T>where
T: Serialize + NetworkContent,
impl<T: Eq + NetworkContent> Eq for NetworkMessage<T>
impl<T: NetworkContent> StructuralPartialEq for NetworkMessage<T>
Auto Trait Implementations§
impl<T> Freeze for NetworkMessage<T>where
T: Freeze,
impl<T> RefUnwindSafe for NetworkMessage<T>where
T: RefUnwindSafe,
impl<T> Send for NetworkMessage<T>
impl<T> Sync for NetworkMessage<T>
impl<T> Unpin for NetworkMessage<T>where
T: Unpin,
impl<T> UnwindSafe for NetworkMessage<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