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]

impl<T: Debug + NetworkContent> Debug for NetworkMessage<T>[src]

impl<'de, T: NetworkContent> Deserialize<'de> for NetworkMessage<T> where
    T: DeserializeOwned
[src]

impl<T: Eq + NetworkContent> Eq for NetworkMessage<T>[src]

impl<T: Hash + NetworkContent> Hash for NetworkMessage<T>[src]

impl<T: Ord + NetworkContent> Ord for NetworkMessage<T>[src]

impl<T: PartialEq + NetworkContent> PartialEq<NetworkMessage<T>> for NetworkMessage<T>[src]

impl<T: PartialOrd + NetworkContent> PartialOrd<NetworkMessage<T>> for NetworkMessage<T>[src]

impl<T: NetworkContent> Serialize for NetworkMessage<T> where
    T: Serialize
[src]

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

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T> HandlerError for T where
    T: Send + Sync + Debug + 'static + Clone
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> NetworkContent for T where
    T: Serialize + DeserializeOwned + Send + Sync + Eq + PartialEq<T> + 'static + Debug
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,