pub struct MessageMetadata {
pub created_at: Timestamp,
pub protocol_version: ProtocolVersion,
pub encoding: Option<String>,
pub content_type: ContentType,
pub size: usize,
pub correlation_id: Option<String>,
pub headers: HashMap<String, String>,
}
Expand description
Message metadata for tracking and debugging
Fields§
§created_at: Timestamp
Message creation timestamp
protocol_version: ProtocolVersion
Protocol version used
encoding: Option<String>
Content encoding (gzip, brotli, etc.)
content_type: ContentType
Content type of the payload
size: usize
Message size in bytes
correlation_id: Option<String>
Correlation ID for request tracing
headers: HashMap<String, String>
Custom headers
Implementations§
Source§impl MessageMetadata
impl MessageMetadata
Sourcepub fn new(content_type: ContentType, size: usize) -> Self
pub fn new(content_type: ContentType, size: usize) -> Self
Create new message metadata
Sourcepub fn with_header(self, key: String, value: String) -> Self
pub fn with_header(self, key: String, value: String) -> Self
Add a custom header
Sourcepub fn with_correlation_id(self, correlation_id: String) -> Self
pub fn with_correlation_id(self, correlation_id: String) -> Self
Set correlation ID for tracing
Sourcepub fn with_encoding(self, encoding: String) -> Self
pub fn with_encoding(self, encoding: String) -> Self
Set content encoding
Trait Implementations§
Source§impl Clone for MessageMetadata
impl Clone for MessageMetadata
Source§fn clone(&self) -> MessageMetadata
fn clone(&self) -> MessageMetadata
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 MessageMetadata
impl Debug for MessageMetadata
Source§impl<'de> Deserialize<'de> for MessageMetadata
impl<'de> Deserialize<'de> for MessageMetadata
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for MessageMetadata
impl RefUnwindSafe for MessageMetadata
impl Send for MessageMetadata
impl Sync for MessageMetadata
impl Unpin for MessageMetadata
impl UnwindSafe for MessageMetadata
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