#[non_exhaustive]
pub struct Platform { pub target_triple: &'static str, pub target_arch: Arch, pub target_os: OS, pub target_env: Env, pub target_pointer_width: PointerWidth, pub target_endian: Endian, pub tier: Tier, }
Expand description

Rust platforms supported by mainline rustc

Sourced from https://doc.rust-lang.org/nightly/rustc/platform-support.html as well as the latest nightly version of rustc

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§target_triple: &'static str

“Target triple” string uniquely identifying the platform. See: https://github.com/rust-lang/rfcs/blob/master/text/0131-target-specification.md

These are defined in the rustc_target crate of the Rust compiler: https://github.com/rust-lang/rust/blob/master/src/librustc_target/spec/mod.rs

§target_arch: Arch

Target architecture cfg attribute (i.e. cfg(target_arch))

§target_os: OS

Target OS cfg attribute (i.e. cfg(target_os)).

§target_env: Env

Target environment cfg attribute (i.e. cfg(target_env)). Only used when needed for disambiguation, e.g. on many GNU platforms this value will be None.

§target_pointer_width: PointerWidth

Target pointer width cfg attribute, in bits (i.e. cfg(target_pointer_width)). Typically 64 on modern platforms, 32 on older platforms, 16 on some microcontrollers.

§target_endian: Endian

Target endianness cfg attribute (i.e. cfg(target_endian)). Set to “little” on the vast majority of modern platforms.

§tier: Tier

Tier of this platform:

  • Tier::One: guaranteed to work
  • Tier::Two: guaranteed to build
  • Tier::Three: unofficially supported with no guarantees

Implementations§

source§

impl Platform

source

pub const ALL: &'static [Platform] = ALL

All valid Rust platforms usable from the mainline compiler.

Note that this list will evolve over time, and platforms will be both added and removed.

source

pub fn find(target_triple: &str) -> Option<&'static Platform>

Find a Rust platform by its “target triple”, e.g. i686-apple-darwin

Trait Implementations§

source§

impl Clone for Platform

source§

fn clone(&self) -> Platform

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Platform

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Platform

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Hash for Platform

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for Platform

source§

fn cmp(&self, other: &Platform) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for Platform

source§

fn eq(&self, other: &Platform) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Platform

source§

fn partial_cmp(&self, other: &Platform) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Eq for Platform

source§

impl StructuralPartialEq for Platform

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<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.