pub enum TargetPredicate {
CargoCfg {
expr: String,
},
OsList {
items: Vec<String>,
},
CpuList {
items: Vec<String>,
},
EngineMin {
engine: String,
min: String,
},
PythonMarker {
marker: String,
},
BundlerPlatforms {
items: Vec<String>,
},
}Expand description
Typed conditional-activation predicate. Adapters set this on
crate::Dependency when the dep is conditional.
Non-recursive on purpose — recursive serde-derived enums explode
the trait-solver depth. Compound predicates (And / Or / Not) live
in CompoundTargetPredicate which holds a flat
Vec<TargetPredicate> + a typed combinator.
Variants§
CargoCfg
cfg(unix) / cfg(target_os = "linux") / etc. — Cargo-style
predicate. Stored as the raw cfg expression; the engine has
a typed cfg evaluator that consumes this against a target spec.
OsList
os array (npm-style): only active on these OS names.
CpuList
cpu array (npm-style): only active on these CPU arches.
EngineMin
Min engine version (npm engines.<runtime> / Composer
php / etc.).
PythonMarker
PEP-508 environment marker (Python pip / poetry).
BundlerPlatforms
Bundler platforms :foo, :bar — list of platform symbols.
Implementations§
Source§impl TargetPredicate
impl TargetPredicate
Sourcepub fn cargo_cfg(expr: impl Into<String>) -> Self
pub fn cargo_cfg(expr: impl Into<String>) -> Self
Convenience constructors that match the old positional shapes.
pub fn os_list(items: impl IntoIterator<Item = impl Into<String>>) -> Self
pub fn cpu_list(items: impl IntoIterator<Item = impl Into<String>>) -> Self
pub fn bundler_platforms( items: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Source§impl TargetPredicate
impl TargetPredicate
Sourcepub fn matches(&self, target: &Target) -> bool
pub fn matches(&self, target: &Target) -> bool
Evaluate this predicate against a concrete Target. Returns
true when the dependency should be active.
Note: full Cargo cfg() evaluation is delegated to the engine
(which has a typed CfgEvaluator); this method falls back to
a conservative “match if cfg is unix/windows/<os>/etc.”
shape for the common cases.
Trait Implementations§
Source§impl Clone for TargetPredicate
impl Clone for TargetPredicate
Source§fn clone(&self) -> TargetPredicate
fn clone(&self) -> TargetPredicate
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TargetPredicate
impl Debug for TargetPredicate
Source§impl<'de> Deserialize<'de> for TargetPredicate
impl<'de> Deserialize<'de> for TargetPredicate
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for TargetPredicate
impl PartialEq for TargetPredicate
Source§fn eq(&self, other: &TargetPredicate) -> bool
fn eq(&self, other: &TargetPredicate) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for TargetPredicate
impl Serialize 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 UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.