pub enum Idiom {
Phone,
Pad,
Mac,
Tv,
Desktop,
Terminal,
}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.
Terminal
A terminal: drawn on a grid of Cells, keyboard first (the terminal backend). The OS stays the machine’s; desktop behavior applies.
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), a
browser in the desktop idiom, or a terminal. desktop={{…}} props,
platform.select({ desktop }) and platform.desktop all follow it,
and so does platform.idiom === "desktop" outside a terminal
(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::Terminal
in a terminal, else 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 Forget for Idiom
impl Freeze for Idiom
impl Move 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.