Enum cfg_expr::expr::TargetPredicate
source · pub enum TargetPredicate {
Abi(Abi),
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
Abi(Abi)
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
sourceimpl 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
sourceimpl Clone for TargetPredicate
impl Clone for TargetPredicate
sourcefn clone(&self) -> TargetPredicate
fn clone(&self) -> TargetPredicate
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for TargetPredicate
impl Debug for TargetPredicate
sourceimpl PartialEq<TargetPredicate> for TargetPredicate
impl PartialEq<TargetPredicate> for TargetPredicate
sourcefn eq(&self, other: &TargetPredicate) -> bool
fn eq(&self, other: &TargetPredicate) -> bool
impl Eq for TargetPredicate
impl StructuralEq for TargetPredicate
impl StructuralPartialEq for TargetPredicate
Auto Trait Implementations
impl RefUnwindSafe for TargetPredicate
impl Send for TargetPredicate
impl Sync for TargetPredicate
impl Unpin for TargetPredicate
impl UnwindSafe for TargetPredicate
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more