pub struct WechatContext {
pub account_key: String,
pub user_id: String,
pub context_token: String,
pub observed_at_unix_ms: i64,
pub source_message_id: Option<String>,
}Expand description
Context information observed from an incoming message.
Carries the context token, user identity, and the account key that
was used to observe it. The Debug impl redacts the context token
to avoid leaking it into logs. Serialization includes the raw token;
do not log serialized contexts.
Fields§
§account_key: StringAccount key used when this context was observed.
user_id: StringWeChat user ID from whom this context was observed.
context_token: StringOpaque context token for reply/send operations.
observed_at_unix_ms: i64Unix timestamp in milliseconds when the context was observed.
source_message_id: Option<String>Message ID of the message that produced this context, if any.
Implementations§
Source§impl WechatContext
impl WechatContext
Sourcepub fn token_fingerprint(&self) -> String
pub fn token_fingerprint(&self) -> String
Returns a stable fingerprint of the context token.
Two contexts with the same token always produce the same fingerprint, regardless of other fields. Useful for detecting token rotation without comparing the raw token.
Sourcepub fn observed_at(&self) -> SystemTime
pub fn observed_at(&self) -> SystemTime
Returns the observation time as a SystemTime.
Trait Implementations§
Source§impl Clone for WechatContext
impl Clone for WechatContext
Source§fn clone(&self) -> WechatContext
fn clone(&self) -> WechatContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WechatContext
impl Debug for WechatContext
Source§impl<'de> Deserialize<'de> for WechatContext
impl<'de> Deserialize<'de> for WechatContext
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>,
Source§impl PartialEq for WechatContext
impl PartialEq for WechatContext
Source§fn eq(&self, other: &WechatContext) -> bool
fn eq(&self, other: &WechatContext) -> bool
self and other values to be equal, and is used by ==.