pub enum Platform {
    Win64,
    Win32,
    Nix64,
    Nix32,
    Mac64,
    Mac32,
    None,
}

Variants

Win64

Win32

Nix64

Nix32

Mac64

Mac32

None

Implementations

Creates a new platform from a string.

Works through a number of different possibilities to make sure the correct platform is matched based on the string entered.

Supports exact matches to the enums as_str and as_short_str as well as pattern matching with keywords such as:

  • 64,32
  • win,nix,linux,mac
  • lxx,wxx,mxx (for short codes)

Creates a copy of the enum object.

Displays the platform object using as_str

returns a String object with the &str value of the platform

Returns a &str constant value for each type.

  • Win64 === ‘Windows x86_64’
  • Win32 === ‘Windows x32’
  • Nix64 === ‘Linux x86_64’
  • Nix32 === ‘Linux x32’
  • Mac64 === ‘Mac OS x86_64’
  • Mac32 === ‘Mac OS x32’
  • None === ‘None’

returns a String object with the short &str value of the platform

Returns a short &str constant value

  • Win64 === ‘win64’
  • Win32 === ‘win32’
  • Nix64 === ‘nix64’
  • Nix32 === ‘nix32’
  • Mac64 === ‘mac64’
  • Mac32 === ‘mac32’
  • None === ‘None’

Checks if a a binary were built for the self platform could be executed on the current user platform.

Assumes that 32 bit applications can be executed on 64 bit platforms. If you don’t want to assume this then don’t use this funtion and instead check absolute equality (==).

Checks if this platform is compatible with the other platform,

Works on the assumption that 32 bit is compatible with 64 bit.

Returns the current user platform

Returns a Vec of all the available execution platforms

Typically its a vector of 1, but also returns the 32bit version on 64bit systems.

An iterator that iterates through all the defined platforms

Trait Implementations

Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.