Enum cfg_expr::expr::TargetPredicate
source · [−]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
sourceimpl TargetPredicate
impl TargetPredicate
sourcepub fn matches<T>(&self, target: &T) -> bool where
T: TargetMatcher,
pub fn matches<T>(&self, target: &T) -> bool where
T: TargetMatcher,
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
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 more
sourceimpl 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
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &TargetPredicate) -> bool
fn ne(&self, other: &TargetPredicate) -> bool
This method tests for !=
.
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 T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more