pub enum TargetPredicate {
    Arch(Arch),
    Endian(Endian),
    Env(Env),
    Family(Family),
    Os(Os),
    PointerWidth(u8),
    Vendor(Vendor),
}
Expand description

All predicates that pertains to a target, except for target_feature

Variants

Arch(Arch)

Endian(Endian)

Env(Env)

Family(Family)

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

Os(Os)

PointerWidth(u8)

Vendor(Vendor)

Implementations

Returns true of the predicate matches the specified target

use cfg_expr::{targets::*, expr::TargetPredicate as tp};
let win = get_builtin_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(Env::msvc).matches(win) &&
    tp::Family(Family::windows).matches(win) &&
    tp::Os(Os::windows).matches(win) &&
    tp::PointerWidth(64).matches(win) &&
    tp::Vendor(Vendor::pc).matches(win)
);

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

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.