pub enum TargetPlatform {
Android,
Fuchsia,
Ios,
Linux,
MacOs,
Windows,
}Expand description
The platforms whose conventions a widget can follow.
Every platform a frus application can run on has its own value, rather than borrowing another’s: a platform folded into another at the start can never be given behaviour of its own without breaking every application that relied on it.
Variants§
Android
Android.
Fuchsia
Fuchsia.
Ios
iOS and iPadOS.
Linux
Linux and the other free Unix desktops.
MacOs
macOS.
Windows
Windows.
Implementations§
Source§impl TargetPlatform
impl TargetPlatform
Sourcepub const ALL: [TargetPlatform; 6]
pub const ALL: [TargetPlatform; 6]
Every platform, in declaration order.
Sourcepub const fn of_build() -> Self
pub const fn of_build() -> Self
The platform this binary was built for. A web build, which is built for no
operating system, reports Android here: what the browser runs on is
default_target_platform’s business.
Sourcepub fn from_browser(
platform: &str,
user_agent: &str,
max_touch_points: i32,
) -> Self
pub fn from_browser( platform: &str, user_agent: &str, max_touch_points: i32, ) -> Self
The platform a browser runs on, from what its navigator says: navigator.platform,
navigator.userAgent and navigator.maxTouchPoints.
An iPad asks for desktop pages and says it is a Mac; it is told apart by its touch
screen. Android’s platform is a Linux, so the user agent is asked first. Anything
unrecognised is Android.
Sourcepub const fn is_apple(self) -> bool
pub const fn is_apple(self) -> bool
iOS or macOS: the platforms that share Apple’s conventions.
Sourcepub const fn is_mobile(self) -> bool
pub const fn is_mobile(self) -> bool
Android, Fuchsia or iOS: the platforms driven by touch first.
Sourcepub const fn is_desktop(self) -> bool
pub const fn is_desktop(self) -> bool
Linux, macOS or Windows: the platforms driven by a mouse and a keyboard first.