Skip to main content

Platform

Struct Platform 

Source
pub struct Platform;
Expand description

Facts about the machine the application runs on, fixed for the life of the process. Unlike TargetPlatform, nothing overrides them.

Implementations§

Source§

impl Platform

Source

pub const fn operating_system() -> &'static str

The operating system this binary was built for, in lower case: "android", "ios", "linux", "macos", "windows"… and "" on the web, which is built for none.

Source

pub const fn is_android() -> bool

Built for Android.

Source

pub const fn is_ios() -> bool

Built for iOS.

Source

pub const fn is_linux() -> bool

Built for Linux (not Android).

Source

pub const fn is_macos() -> bool

Built for macOS.

Source

pub const fn is_windows() -> bool

Built for Windows.

Source

pub const fn is_fuchsia() -> bool

Built for Fuchsia.

Source

pub const fn is_web() -> bool

Built for the web (IS_WEB).

Source

pub fn number_of_processors() -> usize

How many threads the machine can run at once; 1 where it cannot say (a browser).

Source

pub const fn path_separator() -> char

The separator between a path’s components: \ on Windows, / elsewhere.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Msg> IntoMsg<Msg> for Msg

Source§

fn defer(work: impl Fn() -> Msg + 'static) -> Msg

The message that stands for work’s result.
Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.