[][src]Enum cfg_expr::expr::TargetPredicate

pub enum TargetPredicate {
    Arch(Arch),
    Endian(Endian),
    Env(Option<Env>),
    Family(Option<Family>),
    Os(Option<Os>),
    PointerWidth(u8),
    Vendor(Option<Vendor>),
}

All predicates that pertains to a target, except for target_feature

Variants

Arch(Arch)
Endian(Endian)
Env(Option<Env>)
Family(Option<Family>)

target_family This also applies to the bare unix and windows predicates.

Os(Option<Os>)
PointerWidth(u8)
Vendor(Option<Vendor>)

Methods

impl TargetPredicate[src]

pub fn matches(self, target: &TargetInfo) -> bool[src]

Returns true of the predicate matches the specified target

use cfg_expr::{targets::*, expr::TargetPredicate as tp};
let win = get_target_by_triple("x86_64-pc-windows-msvc").unwrap();

assert!(
    tp::Arch(Arch::x86_64).matches(win) &&
    tp::Endian(Endian::little).matches(win) &&
    tp::Env(Some(Env::msvc)).matches(win) &&
    tp::Family(Some(Family::windows)).matches(win) &&
    tp::Os(Some(Os::windows)).matches(win) &&
    tp::PointerWidth(64).matches(win) &&
    tp::Vendor(Some(Vendor::pc)).matches(win)
);

Trait Implementations

impl Clone for TargetPredicate[src]

impl Copy for TargetPredicate[src]

impl Debug for TargetPredicate[src]

impl PartialEq<TargetPredicate> for TargetPredicate[src]

impl StructuralPartialEq for TargetPredicate[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.