pub struct Message<T> {
pub payload: T,
pub metadata: MessageMetadata,
}Expand description
消息封装 (泛型)
Fields§
§payload: T消息体
metadata: MessageMetadata消息元数据
Implementations§
Source§impl<T> Message<T>
impl<T> Message<T>
Sourcepub fn with_correlation_id(self, id: impl Into<String>) -> Self
pub fn with_correlation_id(self, id: impl Into<String>) -> Self
设置关联 ID
Sourcepub fn with_reply_to(self, queue: impl Into<String>) -> Self
pub fn with_reply_to(self, queue: impl Into<String>) -> Self
设置回复队列
Sourcepub fn with_priority(self, priority: u8) -> Self
pub fn with_priority(self, priority: u8) -> Self
设置优先级
Sourcepub fn with_expiration(self, ms: u64) -> Self
pub fn with_expiration(self, ms: u64) -> Self
设置过期时间
Sourcepub fn into_raw(self) -> WaeResult<RawMessage>where
T: Serialize,
pub fn into_raw(self) -> WaeResult<RawMessage>where
T: Serialize,
序列化为原始消息
Sourcepub fn to_raw(&self) -> WaeResult<RawMessage>where
T: Serialize,
pub fn to_raw(&self) -> WaeResult<RawMessage>where
T: Serialize,
序列化为原始消息 (引用版本)
Trait Implementations§
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