#[repr(u8)]pub enum Server {
Pn = 0,
Lid = 1,
Group = 2,
Broadcast = 3,
Newsletter = 4,
Hosted = 5,
HostedLid = 6,
Messenger = 7,
Interop = 8,
Bot = 9,
Legacy = 10,
Call = 11,
}Expand description
Known WhatsApp server identifiers.
Maps to the wire protocol’s AD_JID domain type (u8) and the @server suffix
in JID string representation.
Variants§
Pn = 0
Lid = 1
Group = 2
Broadcast = 3
Newsletter = 4
Hosted = 5
HostedLid = 6
Messenger = 7
Interop = 8
Bot = 9
Legacy = 10
Call = 11
@call call-signaling JID; not an AD server, so it round-trips via JID_PAIR.
Implementations§
Source§impl Server
impl Server
pub fn as_str(self) -> &'static str
Sourcepub fn is_pn_family(self) -> bool
pub fn is_pn_family(self) -> bool
Phone-number-namespaced servers (@s.whatsapp.net, @hosted).
The PN side of the LID↔PN mapping treats these as a single class.
Sourcepub fn is_lid_family(self) -> bool
pub fn is_lid_family(self) -> bool
LID-namespaced servers (@lid, @hosted.lid).
Sourcepub fn renders_agent(self) -> bool
pub fn renders_agent(self) -> bool
Whether the agent byte is part of the rendered JID for this server.
AD-capable servers (Pn/Lid/Hosted/HostedLid) have no agent of their own —
their wire form spells the server as a domain byte, which the decoder
resolves into server rather than keeping — so an agent set on one is
meaningless and stays out of the rendered form. Others (e.g. @bot,
@interop) render it. Single source of truth shared by the formatter and
Jid::is_same_chat_as.
Sourcepub fn carries_phone_number(self) -> bool
pub fn carries_phone_number(self) -> bool
Whether the user part is (or can be) a real phone number, i.e. PII that
must be redacted in tracing fields. LID-family/group/broadcast/newsletter/
bot/call users are pseudonymous or non-personal and are safe to render raw.
Source§impl Server
impl Server
Sourcepub fn parse_known(s: &str) -> Option<Self>
pub fn parse_known(s: &str) -> Option<Self>
Allocation-free server lookup. TryFrom<&str> builds a JidError —
and therefore a String — for an unknown suffix, which the JID scanner
hits on every non-JID string it is asked to classify; this returns the
same answer without paying for the message nobody reads.
Trait Implementations§
impl Copy for Server
impl Eq for Server
Source§impl Ord for Server
impl Ord for Server
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Server
impl PartialOrd for Server
impl StructuralPartialEq for Server
Auto Trait Implementations§
impl Freeze for Server
impl RefUnwindSafe for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl UnsafeUnpin for Server
impl UnwindSafe for Server
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more