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§
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 moresource§impl Debug for TargetPredicate
impl Debug for TargetPredicate
source§impl PartialEq for TargetPredicate
impl PartialEq for TargetPredicate
source§fn eq(&self, other: &TargetPredicate) -> bool
fn eq(&self, other: &TargetPredicate) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for TargetPredicate
impl StructuralPartialEq for TargetPredicate
Auto Trait Implementations§
impl Freeze for TargetPredicate
impl RefUnwindSafe for TargetPredicate
impl Send for TargetPredicate
impl Sync for TargetPredicate
impl Unpin for TargetPredicate
impl UnwindSafe for TargetPredicate
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more