Skip to main content

watermelon_proto/
message.rs

1use bytes::Bytes;
2use bytestring::ByteString;
3
4use crate::{StatusCode, Subject, headers::HeaderMap, subscription_id::SubscriptionId};
5
6#[derive(Debug, Clone, PartialEq, Eq)]
7pub struct MessageBase {
8    pub subject: Subject,
9    pub reply_subject: Option<Subject>,
10    pub headers: HeaderMap,
11    pub payload: Bytes,
12}
13
14#[derive(Debug, Clone, PartialEq, Eq)]
15pub struct ServerMessage {
16    pub status_code: Option<StatusCode>,
17    /// The human readable description following [`Self::status_code`]
18    ///
19    /// Some status codes, like `409`, are used by the NATS Server for
20    /// multiple unrelated conditions which can only be told apart
21    /// via this description.
22    pub status_description: Option<ByteString>,
23    pub subscription_id: SubscriptionId,
24    pub base: MessageBase,
25}