pub struct TransportMessageMetadata {
pub encoding: Option<String>,
pub content_type: Option<String>,
pub correlation_id: Option<String>,
pub headers: HashMap<String, String>,
pub priority: Option<u8>,
pub ttl: Option<u64>,
pub is_heartbeat: Option<bool>,
}Expand description
Metadata associated with a TransportMessage.
Fields§
§encoding: Option<String>The encoding of the message payload (e.g., “gzip”).
content_type: Option<String>The MIME type of the message payload (e.g., “application/json”).
correlation_id: Option<String>An ID used to correlate requests and responses.
headers: HashMap<String, String>A map of custom headers.
priority: Option<u8>The priority of the message (higher numbers indicate higher priority).
ttl: Option<u64>The time-to-live for the message, in milliseconds.
is_heartbeat: Option<bool>A marker indicating that this is a heartbeat message.
Implementations§
Source§impl TransportMessageMetadata
impl TransportMessageMetadata
Sourcepub fn with_content_type(
content_type: impl Into<String>,
) -> TransportMessageMetadata
pub fn with_content_type( content_type: impl Into<String>, ) -> TransportMessageMetadata
Creates a new TransportMessageMetadata with a specified content type.
Sourcepub fn with_correlation_id(
correlation_id: impl Into<String>,
) -> TransportMessageMetadata
pub fn with_correlation_id( correlation_id: impl Into<String>, ) -> TransportMessageMetadata
Creates a new TransportMessageMetadata with a specified correlation ID.
Sourcepub fn with_header(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> TransportMessageMetadata
pub fn with_header( self, key: impl Into<String>, value: impl Into<String>, ) -> TransportMessageMetadata
Adds a header to the metadata using a builder pattern.
Sourcepub const fn with_priority(self, priority: u8) -> TransportMessageMetadata
pub const fn with_priority(self, priority: u8) -> TransportMessageMetadata
Sets the priority of the message.
Sourcepub const fn with_ttl(self, ttl: Duration) -> TransportMessageMetadata
pub const fn with_ttl(self, ttl: Duration) -> TransportMessageMetadata
Sets the time-to-live for the message.
Sourcepub const fn heartbeat(self) -> TransportMessageMetadata
pub const fn heartbeat(self) -> TransportMessageMetadata
Marks the message as a heartbeat.
Trait Implementations§
Source§impl Clone for TransportMessageMetadata
impl Clone for TransportMessageMetadata
Source§fn clone(&self) -> TransportMessageMetadata
fn clone(&self) -> TransportMessageMetadata
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 Debug for TransportMessageMetadata
impl Debug for TransportMessageMetadata
Source§impl Default for TransportMessageMetadata
impl Default for TransportMessageMetadata
Source§fn default() -> TransportMessageMetadata
fn default() -> TransportMessageMetadata
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for TransportMessageMetadata
impl<'de> Deserialize<'de> for TransportMessageMetadata
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TransportMessageMetadata, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TransportMessageMetadata, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for TransportMessageMetadata
impl Serialize for TransportMessageMetadata
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for TransportMessageMetadata
impl RefUnwindSafe for TransportMessageMetadata
impl Send for TransportMessageMetadata
impl Sync for TransportMessageMetadata
impl Unpin for TransportMessageMetadata
impl UnsafeUnpin for TransportMessageMetadata
impl UnwindSafe for TransportMessageMetadata
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