pub struct MessageMetadata {
pub id: String,
pub content: String,
pub timestamp: String,
pub topic_id: Option<String>,
pub partition_id: Option<usize>,
pub schema: Option<MessageSchema>,
}Expand description
Represents metadata for a message in the broker
Fields§
§id: StringThe unique identifier of the message
content: StringThe content of the message
timestamp: StringThe timestamp when the message was created
topic_id: Option<String>The topic this message belongs to
partition_id: Option<usize>The partition this message belongs to
schema: Option<MessageSchema>The schema of the message, if any
Implementations§
Source§impl MessageMetadata
impl MessageMetadata
Sourcepub fn new(id: String, content: String, timestamp: String) -> Self
pub fn new(id: String, content: String, timestamp: String) -> Self
Creates a new instance of MessageMetadata
Sourcepub fn with_topic(self, topic_id: String) -> Self
pub fn with_topic(self, topic_id: String) -> Self
Sets the topic ID for this metadata
Sourcepub fn with_partition(self, partition_id: usize) -> Self
pub fn with_partition(self, partition_id: usize) -> Self
Sets the partition ID for this metadata
Sourcepub fn with_schema(self, schema: MessageSchema) -> Self
pub fn with_schema(self, schema: MessageSchema) -> Self
Sets the schema for this metadata
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
Source§impl From<Message> for MessageMetadata
impl From<Message> for MessageMetadata
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<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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