Struct netty_rs::NetworkMessage [−][src]
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, }
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
impl<T: NetworkContent> NetworkMessage<T>
[src]
pub fn new(to: Arc<String>, from: Arc<String>, content: T) -> Self
[src]
Create a new fresh message
pub fn reply(&self, content: T) -> Self
[src]
Used to construct replies to the provided message.
Trait Implementations
impl<T: Clone + NetworkContent> Clone for NetworkMessage<T>
[src]
fn clone(&self) -> NetworkMessage<T>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Debug + NetworkContent> Debug for NetworkMessage<T>
[src]
impl<'de, T: NetworkContent> Deserialize<'de> for NetworkMessage<T> where
T: DeserializeOwned,
[src]
T: DeserializeOwned,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<T: Eq + NetworkContent> Eq for NetworkMessage<T>
[src]
impl<T: Hash + NetworkContent> Hash for NetworkMessage<T>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T: Ord + NetworkContent> Ord for NetworkMessage<T>
[src]
fn cmp(&self, other: &NetworkMessage<T>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<T: PartialEq + NetworkContent> PartialEq<NetworkMessage<T>> for NetworkMessage<T>
[src]
fn eq(&self, other: &NetworkMessage<T>) -> bool
[src]
fn ne(&self, other: &NetworkMessage<T>) -> bool
[src]
impl<T: PartialOrd + NetworkContent> PartialOrd<NetworkMessage<T>> for NetworkMessage<T>
[src]
fn partial_cmp(&self, other: &NetworkMessage<T>) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<T: NetworkContent> Serialize for NetworkMessage<T> where
T: Serialize,
[src]
T: Serialize,
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<T: NetworkContent> StructuralEq for NetworkMessage<T>
[src]
impl<T: NetworkContent> StructuralPartialEq for NetworkMessage<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for NetworkMessage<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for NetworkMessage<T>
impl<T> Sync for NetworkMessage<T>
impl<T> Unpin for NetworkMessage<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for NetworkMessage<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T> HandlerError for T where
T: Send + Sync + Debug + 'static + Clone,
[src]
T: Send + Sync + Debug + 'static + Clone,
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> NetworkContent for T where
T: Serialize + DeserializeOwned + Send + Sync + Eq + PartialEq<T> + 'static + Debug,
[src]
T: Serialize + DeserializeOwned + Send + Sync + Eq + PartialEq<T> + 'static + Debug,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,