#[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<Server>
pub fn parse_known(s: &str) -> Option<Server>
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
Source§impl<'de> Deserialize<'de> for Server
Available on crate feature serde only.
impl<'de> Deserialize<'de> for Server
serde only.Source§fn deserialize<D>(
deserializer: D,
) -> Result<Server, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Server, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
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
Source§impl Serialize for Server
Available on crate feature serde only.
impl Serialize for Server
serde only.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 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> 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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> ErasedDestructor for Twhere
T: 'static,
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 moreimpl<T> MaybeSend for T
impl<T> MaybeSendSync for T
impl<T> Spawnable for Twhere
T: Send + '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