pub struct Message<T> {
pub topic: String,
pub payload: T,
pub offset: Option<i64>,
pub partition: Option<i32>,
}Expand description
A streaming message wrapping a typed payload with topic and offset metadata.
Fields§
§topic: StringTopic from which the message was received or to which it will be sent.
payload: TTyped message payload.
offset: Option<i64>Backend offset, when provided by the streaming provider.
partition: Option<i32>Backend partition, when provided by the streaming provider.
Implementations§
Source§impl<T> Message<T>
impl<T> Message<T>
Sourcepub fn new(topic: impl Into<String>, payload: T) -> Self
pub fn new(topic: impl Into<String>, payload: T) -> Self
Create a message with topic and payload metadata.
Sourcepub fn with_offset(self, offset: i64) -> Self
pub fn with_offset(self, offset: i64) -> Self
Attach a backend offset to the message.
Sourcepub fn with_partition(self, partition: i32) -> Self
pub fn with_partition(self, partition: i32) -> Self
Attach a backend partition to the message.
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Message<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Message<T>where
T: Deserialize<'de>,
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<T> Freeze for Message<T>where
T: Freeze,
impl<T> RefUnwindSafe for Message<T>where
T: RefUnwindSafe,
impl<T> Send for Message<T>where
T: Send,
impl<T> Sync for Message<T>where
T: Sync,
impl<T> Unpin for Message<T>where
T: Unpin,
impl<T> UnsafeUnpin for Message<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Message<T>where
T: UnwindSafe,
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