Skip to main content

one_storage_marker

Function one_storage_marker 

Source
pub fn one_storage_marker(prefix: &EmissionPrefix, record: &Ident) -> Ident
Expand description

The item a storage node mints so that a second storage on the same type cannot be spelled.

Two macro expansions cannot see one another, so #[ingraph::fulltext(…)] beside #[ingraph::vector(…)] is not detectable by either of them. What IS detectable is the collision the two expansions make: each mints this name in the declaring scope, and two of them are E0428 — the name __ig_<Record>_holds_one_storage is defined multiple times — reported at the offending type, with rustc’s own note naming the second macro. The invariant is enforced by construction rather than documented beside the code.

It carries the RECORD’s name because the scope is the declarer’s: two storage nodes in one module are an ordinary program, and a marker that named only the framework would refuse it.

A const and not a unit struct, which would occupy the type namespace as well for no gain, and PRIVATE, so a marker never joins the declaring crate’s public API. Both of those and the namespace mark are why the emission spends three allows on it: it is dead by construction, its name is neither upper case nor camel case, and nothing may make a declaration fail its own -D warnings build over an item its author did not write.

It is PREFIXED rather than framed: the frame is the column law, and this is an item. It also takes the model’s own EmissionPrefix, which is what makes two FRAMEWORKS’ storage nodes on one type an ordinary program — __ig_Clip_holds_one_storage and __mg_Clip_holds_one_storage are two names, so the refusal stays what it is for, a SECOND storage under ONE framework.