[][src]Struct nats::Message

pub struct Message {
    pub subject: String,
    pub reply: Option<String>,
    pub data: Vec<u8>,
    pub headers: Option<Headers>,
    // some fields omitted
}

A Message that has been published to a NATS Subject.

Fields

subject: String

The NATS Subject that this Message has been published to.

reply: Option<String>

The optional reply Subject that may be used for sending responses when using the request/reply pattern.

data: Vec<u8>

The Message contents.

headers: Option<Headers>

Optional headers associated with this Message.

Implementations

impl Message[src]

pub fn respond(&self, msg: impl AsRef<[u8]>) -> Result<()>[src]

Respond to a request message.

Example

nc.subscribe("help.request")?.with_handler(move |m| {
    m.respond("ans=42")?; Ok(())
});

Trait Implementations

impl Clone for Message[src]

impl Debug for Message[src]

impl Display for Message[src]

Auto Trait Implementations

impl !RefUnwindSafe for Message

impl Send for Message

impl Sync for Message

impl Unpin for Message

impl !UnwindSafe for Message

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> From<T> for T[src]

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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>,