Skip to main content

cfg_feature

Function cfg_feature 

pub fn cfg_feature(attrs: &[Attribute]) -> Option<String>
Expand description

The feature named by an item’s #[cfg(feature = "…")], if it has one.

Only the single-feature form is understood. Anything else — an all(…), an any(…), a not(…), a target_os — returns Ok(None) with the attribute still present, which the caller must treat as unclassifiable rather than as “no gate”: publishing a conditional item as unconditional is exactly the invention §7 constraint 3 forbids.