pub struct MsgHead {
pub msg_id: Option<u64>,
pub create_time: Option<u64>,
pub modify_time: Option<u64>,
pub msg_sequence: Option<u64>,
pub inner_sequence: Option<u64>,
pub status: Option<u32>,
}Expand description
以下为抽象的公共消息定义 消息头 + body
Fields§
§msg_id: Option<u64>消息ID
create_time: Option<u64>消息创建时间
modify_time: Option<u64>消息修改时间
msg_sequence: Option<u64>业务序列号,业务保证有序
inner_sequence: Option<u64>内部序列号,保证唯一
status: Option<u32>消息状态标志, 后续扩展, 已读标记/增量删除/已撤回等状态信息
Implementations§
Source§impl MsgHead
impl MsgHead
Sourcepub fn msg_id(&self) -> u64
pub fn msg_id(&self) -> u64
Returns the value of msg_id, or the default value if msg_id is unset.
Sourcepub fn create_time(&self) -> u64
pub fn create_time(&self) -> u64
Returns the value of create_time, or the default value if create_time is unset.
Sourcepub fn modify_time(&self) -> u64
pub fn modify_time(&self) -> u64
Returns the value of modify_time, or the default value if modify_time is unset.
Sourcepub fn msg_sequence(&self) -> u64
pub fn msg_sequence(&self) -> u64
Returns the value of msg_sequence, or the default value if msg_sequence is unset.
Sourcepub fn inner_sequence(&self) -> u64
pub fn inner_sequence(&self) -> u64
Returns the value of inner_sequence, or the default value if inner_sequence is unset.
Trait Implementations§
Source§impl Message for MsgHead
impl Message for MsgHead
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Returns the encoded length of the message without a length delimiter.
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Encodes the message to a buffer. Read more
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Encodes the message to a newly allocated buffer.
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Encodes the message with a length-delimiter to a buffer. Read more
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Encodes the message with a length-delimiter to a newly allocated buffer.
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Decodes an instance of the message from a buffer. Read more
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Decodes a length-delimited instance of the message from the buffer.
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
Decodes an instance of the message from a buffer, and merges it into
self. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
Decodes a length-delimited instance of the message from buffer, and
merges it into
self.impl Copy for MsgHead
impl Eq for MsgHead
impl StructuralPartialEq for MsgHead
Auto Trait Implementations§
impl Freeze for MsgHead
impl RefUnwindSafe for MsgHead
impl Send for MsgHead
impl Sync for MsgHead
impl Unpin for MsgHead
impl UnsafeUnpin for MsgHead
impl UnwindSafe for MsgHead
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.