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
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