pub struct Jid {
pub user: String,
pub server: Cow<'static, str>,
pub agent: u8,
pub device: u16,
pub integrator: u16,
}Fields§
§user: String§server: Cow<'static, str>§agent: u8§device: u16§integrator: u16Implementations§
Source§impl Jid
impl Jid
pub fn new(user: &str, server: &str) -> Jid
Sourcepub fn status_broadcast() -> Jid
pub fn status_broadcast() -> Jid
Creates the status@broadcast JID used for status/story updates.
Create a newsletter (channel) JID (newsletter server).
Sourcepub fn pn_device(user: impl Into<String>, device: u16) -> Jid
pub fn pn_device(user: impl Into<String>, device: u16) -> Jid
Create a phone number JID with device ID
Sourcepub fn user_base(&self) -> &str
pub fn user_base(&self) -> &str
Returns the user part without the device ID suffix (e.g., “123:4” -> “123”)
Sourcepub fn with_device(&self, device_id: u16) -> Jid
pub fn with_device(&self, device_id: u16) -> Jid
Helper to construct a specific device JID from this one
pub fn actual_agent(&self) -> u8
pub fn to_non_ad(&self) -> Jid
Sourcepub fn matches_user_or_lid(&self, user: &Jid, lid: Option<&Jid>) -> bool
pub fn matches_user_or_lid(&self, user: &Jid, lid: Option<&Jid>) -> bool
Check if this JID matches the user or their LID. Useful for checking if a participant is “us” in group messages.
Sourcepub fn normalize_for_prekey_bundle(&self) -> Jid
pub fn normalize_for_prekey_bundle(&self) -> Jid
Normalize the JID for use in pre-key bundle storage and lookup.
WhatsApp servers may return JIDs with varied agent fields, or we might derive them with agent fields in some contexts. However, pre-key bundles are stored and looked up using a normalized key where the agent is 0 for standard servers (s.whatsapp.net, lid).
pub fn to_ad_string(&self) -> String
Sourcepub fn device_eq(&self, other: &Jid) -> bool
pub fn device_eq(&self, other: &Jid) -> bool
Compare device identity (user, server, device) without allocation.
Sourcepub fn device_key(&self) -> DeviceKey<'_>
pub fn device_key(&self) -> DeviceKey<'_>
Get a borrowing key for O(1) HashSet lookups by device identity.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Jid
impl<'de> Deserialize<'de> for Jid
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Jid, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Jid, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl JidExt for Jid
impl JidExt for Jid
Source§fn to_protocol_address(&self) -> ProtocolAddress
fn to_protocol_address(&self) -> ProtocolAddress
Build a ProtocolAddress for Signal session store lookups.
The device_id is always 0 — WhatsApp encodes the device in the name.
Source§fn to_signal_address_string(&self) -> String
fn to_signal_address_string(&self) -> String
{user}[:device]@{server} Read moreSource§fn to_protocol_address_string(&self) -> String
fn to_protocol_address_string(&self) -> String
{signal_address_string}.0
This is equivalent to to_protocol_address().to_string() but avoids
the intermediate ProtocolAddress allocation — one String instead of two.Source§impl JidExt for Jid
impl JidExt for Jid
fn user(&self) -> &str
fn server(&self) -> &str
fn device(&self) -> u16
fn integrator(&self) -> u16
fn is_ad(&self) -> bool
fn is_interop(&self) -> bool
fn is_messenger(&self) -> bool
fn is_group(&self) -> bool
fn is_broadcast_list(&self) -> bool
fn is_status_broadcast(&self) -> bool
fn is_bot(&self) -> bool
Source§fn is_hosted(&self) -> bool
fn is_hosted(&self) -> bool
fn is_empty(&self) -> bool
fn is_same_user_as(&self, other: &impl JidExt) -> bool
Source§impl Serialize for Jid
impl Serialize for Jid
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for Jid
impl StructuralPartialEq for Jid
Auto Trait Implementations§
impl Freeze for Jid
impl RefUnwindSafe for Jid
impl Send for Jid
impl Sync for Jid
impl Unpin for Jid
impl UnsafeUnpin for Jid
impl UnwindSafe for Jid
Blanket Implementations§
Source§impl<T> AggregateExpressionMethods for T
impl<T> AggregateExpressionMethods for T
Source§fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
DISTINCT modifier for aggregate functions Read moreSource§fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
ALL modifier for aggregate functions Read moreSource§fn aggregate_filter<P>(self, f: P) -> Self::Output
fn aggregate_filter<P>(self, f: P) -> Self::Output
Source§fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
self to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
&self to an expression for Diesel’s query builder. Read more