Expand description
The attributes that decide whether a handler, or one of its enhancer entries, is compiled,
which #[handlers] copies onto every item it writes that names the handler’s generated items,
and the reading of a method’s attributes through cfg_attr.
An attribute macro receives the items inside its input with their #[cfg] and #[cfg_attr]
unevaluated, so #[handlers] sees a method behind #[cfg(feature = "x")] whether or not the
feature is on. Rustc evaluates that cfg after #[handlers] has expanded, and with the feature
off it removes the method together with its transport attribute, which then writes none of
__ULO_KEY_<name>, __ULO_CHECKS_<name> and __ulo_mount_<name>. Likewise
#[cfg_attr(feature = "x", guards(..))] reaches #[handlers] as a cfg_attr, and expands to
#[guards(..)] only after #[handlers] has run; take reads through it, so #[handlers] takes
the entry with its predicate as a gate.
Structs§
- Gated
Attr - One attribute as rustc applies it once every
cfg_attraround it is evaluated, with the predicates of thosecfg_attrs, outermost first. An attribute written outside anycfg_attrhas no predicates.
Functions§
- gates_
of - One
#[cfg(<predicate>)]per predicate, spanned at the predicate. - leaves
- Every outer attribute among
attrs, read throughcfg_attrat any depth, in the order written:#[cfg_attr(a, inline, cfg_attr(b, get("/")))]yieldsinlinebehindaandget("/")behindaandb. An inner attribute, or acfg_attrwhose arguments do not read as a predicate followed by attributes, is yielded whole, with no predicates. - presence_
gates - The attributes among
attrsthat decide whether the item carrying them is compiled, each as an outer attribute: everycfgas written, and everycfg_attrwhose expansion holds acfg, reduced to the branches that hold one. The reduction keeps an attribute that applies only to a method, such as#[cfg_attr(test, cfg(unix), inline)]’sinline, off the items a copy goes on. Empty for an item compiled in every configuration. - take
- Removes from
attrsevery attributeleavesyields thattakeaccepts, and returns those, in the order written. Acfg_attrleft holding nothing is removed; one holding something else keeps it:#[cfg_attr(p, doc = "..", guards(A))]becomes#[cfg_attr(p, doc = "..")]. - under
#[cfg_attr(<predicates>, <meta>)], the predicates joined withall(..)when there are several;#[<meta>]when there are none.