pub enum CompanionOs {
Windows,
MacOs,
Linux,
Android,
Ios,
}Expand description
Canonical OS label for the pair-code companion_platform_display.
WA Web only ever emits a real OS name from its UA parser
(WAWebBrowserInfo().os → ua-parser-js getOS().name). Unlike QR pairing —
which never sends this field and therefore tolerates an arbitrary branding
string in DeviceProps::os — the pair-code companion_hello server
rejects a non-OS display with bad-request. So the OS component must come
from a closed set of real OS names, never the free-form branding string.
The set is deliberately small and conservative: the server is lenient toward
real OS names today (it also accepts Ubuntu, Fedora, Mac, …), but
collapsing everything to a guaranteed-accepted canonical value is robust
against that leniency changing. Anything unrecognized coerces to
Self::Linux (see Self::from_hint).
Variants§
Implementations§
Source§impl CompanionOs
impl CompanionOs
Sourcepub const fn wire_str(self) -> &'static str
pub const fn wire_str(self) -> &'static str
The exact wire string, matching ua-parser-js getOS().name (what WA Web
sends) — note the "Mac OS" and "iOS" spellings.
Sourcepub fn classify(os: &str) -> Option<CompanionOs>
pub fn classify(os: &str) -> Option<CompanionOs>
Classify a free-form OS hint into a known canonical OS, or None when it
is not recognizably an OS (empty, or a branding label such as "Veloz").
Case-insensitive. iPad folds to Self::Ios: older UA parsers report iPad
as "iOS", so "iPadOS" is not a confirmed server-accepted value. Chrome
OS and Linux distros fold to Self::Linux.
Sourcepub fn from_hint(os: &str) -> CompanionOs
pub fn from_hint(os: &str) -> CompanionOs
Coerce a free-form DeviceProps::os into a server-safe canonical OS,
defaulting an unrecognized/branding value to Self::Linux.
Trait Implementations§
Source§impl Clone for CompanionOs
impl Clone for CompanionOs
Source§fn clone(&self) -> CompanionOs
fn clone(&self) -> CompanionOs
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for CompanionOs
Source§impl Debug for CompanionOs
impl Debug for CompanionOs
impl Eq for CompanionOs
Source§impl PartialEq for CompanionOs
impl PartialEq for CompanionOs
impl StructuralPartialEq for CompanionOs
Auto Trait Implementations§
impl Freeze for CompanionOs
impl RefUnwindSafe for CompanionOs
impl Send for CompanionOs
impl Sync for CompanionOs
impl Unpin for CompanionOs
impl UnsafeUnpin for CompanionOs
impl UnwindSafe for CompanionOs
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§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 more