pub struct Environment {Show 43 fields
pub window: Size<Points>,
pub horizontal_size_class: Option<SizeClass>,
pub vertical_size_class: Option<SizeClass>,
pub safe_area: EdgeInsets,
pub reserved_regions: ReservedRegions,
pub title_bar: Edges<Points>,
pub window_state: Option<WindowState>,
pub keyboard_height: Points,
pub keyboard_duration: f32,
pub dark: bool,
pub font_scale: f32,
pub reduce_motion: bool,
pub screen_reader: bool,
pub reads_active_descendants: bool,
pub rtl: bool,
pub pixel_ratio: f32,
pub os: Os,
pub platform: Option<&'static str>,
pub os_version: (u16, u16),
pub idiom: Idiom,
pub locale: Locale,
pub locale_settings: LocaleSettings,
pub apple_keyboard: bool,
pub ctrl_for_command: bool,
pub host: bool,
pub lifecycle: Lifecycle,
pub wake_count: u32,
pub network: Network,
pub screen_color: bool,
pub clipboard_write_result: bool,
pub canvas_render: bool,
pub app_settings: bool,
pub scheme_links: bool,
pub file_requests: bool,
pub notifications: bool,
pub audio: bool,
pub tab_bar: bool,
pub cell: Option<Size<Points>>,
pub web_input: bool,
pub web_evaluate: bool,
pub web_views: bool,
pub webview_requests: bool,
pub shaders: bool,
}Expand description
The environment of a surface, as the platform reports it.
Fields§
§window: Size<Points>The surface’s size in points.
horizontal_size_class: Option<SizeClass>Native horizontal size class, or None to use the window width at 600pt.
vertical_size_class: Option<SizeClass>Native vertical size class, or None to use the window height at 600pt.
safe_area: EdgeInsetsThe edges system UI covers.
reserved_regions: ReservedRegionsThe parts of the surface the device reserves
(crate::platform::Environment::reserved_regions).
title_bar: Edges<Points>Space reserved for system controls in a custom desktop title bar.
window_state: Option<WindowState>The app’s window: its bounds, mode and display (desktops).
keyboard_height: PointsThe software keyboard’s height, 0 when hidden.
keyboard_duration: f32How long the keyboard’s show / hide animation takes, in milliseconds.
dark: boolDark appearance.
font_scale: f32The user’s text size relative to the default.
reduce_motion: boolLess motion asked for.
screen_reader: boolA screen reader runs.
reads_active_descendants: boolThe platform’s screen readers follow active descendants
(crate::platform::Environment::reads_active_descendants).
rtl: boolRight-to-left layout.
pixel_ratio: f32Device pixels per point.
os: OsThe operating system.
platform: Option<&'static str>The platform’s name where it is not the OS’s (a platform built
outside NSH: crate::platform::Environment::platform).
os_version: (u16, u16)The OS version: major and minor (iOS), Android’s API level and 0.
idiom: IdiomThe kind of device.
locale: LocaleThe user’s locale, for formatting numbers and dates.
locale_settings: LocaleSettingsThe user’s locale settings: the preferred languages, the time zone and the regional preferences.
apple_keyboard: boolIn a browser, it runs on an Apple platform: shortcuts follow Apple’s
conventions (crate::keymap::apple_keys); the other OSes imply
theirs.
ctrl_for_command: boolCtrl stands in for Command: labels show Command as Ctrl
(crate::platform::Environment::ctrl_for_command).
host: boolThe embedding app answers nsh/host’s calls
(crate::platform::Environment::host).
lifecycle: LifecycleWhether the app is in use: in the foreground, visible without the focus, or in the background.
wake_count: u32How many times the system woke from sleep while the surface ran
(crate::platform::Environment::wake_count).
network: NetworkHow the device reaches the network
(crate::platform::Environment::network).
screen_color: boolThe platform picks colors from the screen
(crate::platform::Environment::screen_color).
clipboard_write_result: boolThe platform reports clipboard writes’ results
(crate::platform::Environment::clipboard_write_result).
canvas_render: boolThe platform renders canvas drawings offscreen into images
(crate::platform::Environment::canvas_render).
app_settings: boolThe platform opens the app’s page in the system’s settings
(crate::platform::Environment::app_settings).
scheme_links: boolLinks of the schemes the app claims reach it
(crate::platform::Environment::scheme_links, resolved: true
on every OS but the web unless the platform says otherwise).
file_requests: boolThe platform shows file dialogs and opens, reveals and trashes local
paths (crate::platform::Environment::file_requests).
notifications: boolThe platform shows notifications
(crate::platform::Environment::notifications).
audio: boolThe platform plays sound
(crate::platform::Environment::audio).
tab_bar: boolThe platform shows the system’s tab bar on iOS and Android
(crate::platform::Environment::tab_bar).
cell: Option<Size<Points>>The Cell size of a grid surface (a terminal): the core lays out in
its Cells (crate::platform::Environment::cell); None elsewhere.
web_input: boolThe platform gives web views trusted input
(crate::platform::Environment::web_input).
web_evaluate: boolThe platform answers awaitable WebView evaluations
(crate::Command::Evaluate); false rejects as unavailable.
web_views: boolThe platform shows web views
(crate::platform::Environment::web_views).
webview_requests: boolThe platform carries out web view requests
(crate::platform::Environment::webview_requests).
shaders: boolThe platform draws shader views
(crate::platform::Environment::shaders).
Implementations§
Source§impl Environment
impl Environment
Sourcepub fn platform_name(&self) -> &'static str
pub fn platform_name(&self) -> &'static str
The platform’s name (TS: platform.name): a platform built outside
NSH’s own, else the OS’s.