pub struct Environment {Show 17 fields
pub window: Size<Points>,
pub safe_area: Edges<Points>,
pub title_bar: Edges<Points>,
pub keyboard_height: Points,
pub keyboard_duration: f32,
pub color_scheme: ColorScheme,
pub font_scale: f32,
pub rtl: bool,
pub reduce_motion: bool,
pub pixel_ratio: f32,
pub screen_reader: bool,
pub os: Os,
pub os_version: (u16, u16),
pub idiom: Idiom,
pub apple_keyboard: bool,
pub locale: Locale,
pub host: bool,
}Expand description
What the platform knows about the surface.
Fields§
§window: Size<Points>Size of the surface in points.
safe_area: Edges<Points>Insets not covered by system UI (notch, home indicator, title bar).
title_bar: Edges<Points>The title bar’s area while the app hides it (desktops,
crate::desktop::TitleBarStyle::Hidden): top is its height,
left and right the widths the system’s window controls take at
its ends (bottom is 0); all 0 while the system shows its title
bar.
keyboard_height: PointsHeight of the software keyboard over the surface; 0 when hidden.
keyboard_duration: f32Duration of the keyboard’s show / hide animation in seconds.
color_scheme: ColorSchemeLight or dark appearance.
font_scale: f32Preferred text size relative to the default (1.0).
rtl: boolThe user’s language is written right to left.
reduce_motion: boolThe user asked for less motion (iOS Reduce Motion, Android’s animator duration scale at 0).
pixel_ratio: f32Device pixels per point.
screen_reader: boolA screen reader runs (VoiceOver, TalkBack).
os: OsThe operating system.
os_version: (u16, u16)The OS version: major and minor (iOS, desktops), Android’s API level and 0.
idiom: IdiomThe kind of device.
apple_keyboard: boolA browser on an Apple platform (macOS, iOS): its keyboard shortcuts
follow Apple’s conventions (crate::keymap::apple_keys: mod is
Command, labels use ⌘). Only read for Os::Web; the other OSes
imply theirs.
locale: LocaleThe user’s locale (number and date formats: Intl’s default).
host: boolThe app embedding NSH answers nsh/host’s calls
(crate::Command::HostCall); without it, they reject at once.
Implementations§
Trait Implementations§
Source§impl Clone for Environment
impl Clone for Environment
Source§fn clone(&self) -> Environment
fn clone(&self) -> Environment
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more