Skip to main content

macro_declared

Function macro_declared 

fn macro_declared(items: &[&Item]) -> Vec<(String, Kind)>
Expand description

Public items declared by a macro_rules! expansion, which no parse of the source can see as items: the struct is in the expansion, not in the file.

crates/atune_core/src/id.rs is the case — StudyId, TrialId, TrialNumber and WorkerId are four define_id! invocations, all four are re-exported as atune::id::*, and rustdoc files them under struct.StudyId.html. Read as a registry rather than recorded as a list:

  1. a macro_rules! definition whose expansion carries exactly one pub <keyword> declaration at its own top level declares items of that kind — a pub const fn inside an impl block is nested, and is not counted;
  2. an invocation of such a macro declares the one bare identifier it carries at the top level, doc comments (which tokenise as #[doc = …] groups) excluded.

Anything else contributes nothing, so the name stays unresolved and the caller reports it. A macro this reading misjudges cannot pass silently either: the kind it yields would sit beside the declaration the parse can see, and two kinds for one name is an error.