Enum cfg_expr::expr::TargetPredicate
source · pub enum TargetPredicate {
Arch(Arch),
Endian(Endian),
Env(Env),
Family(Family),
HasAtomic(HasAtomic),
Os(Os),
Panic(Panic),
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.
HasAtomic(HasAtomic)
Os(Os)
Panic(Panic)
PointerWidth(u8)
Vendor(Vendor)
Implementations§
source§impl TargetPredicate
impl TargetPredicate
sourcepub fn matches<T>(&self, target: &T) -> boolwhere
T: TargetMatcher,
pub fn matches<T>(&self, target: &T) -> boolwhere
T: TargetMatcher,
Returns true of the predicate matches the specified target
Note that when matching against a [target_lexicon::Triple
], the
has_target_atomic
and panic
predicates will always return false
.
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§
source§impl Clone for TargetPredicate
impl Clone for TargetPredicate
source§fn clone(&self) -> TargetPredicate
fn clone(&self) -> TargetPredicate
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more