pub enum Idiom {
Phone,
Pad,
Mac,
Tv,
Desktop,
}Expand description
The kind of device (platform.idiom).
Variants§
Phone
A phone.
Pad
A tablet.
Mac
UIKit’s Mac idiom (Mac Catalyst optimized for Mac). Catalyst runs
the iOS backend, so this idiom is mobile, not Idiom::Desktop.
Tv
A TV.
Desktop
Desktop: a desktop backend (macOS, Windows, Linux), or a browser with
a mouse and a wide viewport (Idiom::desktop_on). Mac Catalyst is
Idiom::Pad or Idiom::Mac, as UIKit reports.
Implementations§
Source§impl Idiom
impl Idiom
Sourcepub fn desktop_on(self, os: Os) -> bool
pub fn desktop_on(self, os: Os) -> bool
Whether desktop behavior applies on os in this idiom, NSH’s one
definition of desktop: a desktop OS (macOS, Windows, Linux), or a
browser in the desktop idiom. desktop={{…}} props,
platform.select({ desktop }), platform.desktop and
platform.idiom === "desktop" all follow it (Idiom::reported_on).
Sourcepub fn reported_on(self, os: Os) -> Idiom
pub fn reported_on(self, os: Os) -> Idiom
The idiom apps see on os (TS: platform.idiom): Idiom::Desktop
exactly where Idiom::desktop_on holds, so that "desktop" agrees
with desktop behavior whatever a platform (or a test) set. Elsewhere
this idiom, and Idiom::Phone for Idiom::Desktop on a mobile OS.
Trait Implementations§
impl Copy for Idiom
impl Eq for Idiom
impl StructuralPartialEq for Idiom
Auto Trait Implementations§
impl Freeze for Idiom
impl RefUnwindSafe for Idiom
impl Send for Idiom
impl Sync for Idiom
impl Unpin for Idiom
impl UnsafeUnpin for Idiom
impl UnwindSafe for Idiom
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.