Skip to main content

dataflow_attr

Function dataflow_attr 

Source
pub fn dataflow_attr(attr: &Attribute) -> Option<(Attribute, Option<String>)>
Expand description

Unwrap a #[dataflow] attribute, including any #[cfg_attr(...)] wrapper.

Returns the inner #[dataflow] attribute and the combined cfg predicate, or None for non-dataflow attributes. A bare #[dataflow] returns the attribute and None; nested cfg_attr predicates are folded into all(outer, inner).

Who needs the unwrap: everything that reads attributes as written. The compiler applies cfg_attr before #[dataflow] itself runs, but the #[dataflow_bundle] macro receives its module’s member fns with their attributes untouched, and the textual scanners (scan_dataflow, the tools crate) read source. The predicate is how a wrapped fn’s accesses keep the cfg they are conditional on, as a #[cfg] on the fn would.