pub struct FlagsModel {
pub krate: Path,
pub vis: Visibility,
pub name: Ident,
pub width: BitWidth,
pub bits: Vec<FlagBit>,
pub attrs: Vec<Attribute>,
pub remote: Option<Path>,
pub wire_name: Option<String>,
}Expand description
One flags declaration, validated.
Public fields for EnumModel’s reason: nothing here parses, so
a front end that is not the attribute builds the same struct and reaches the same emitter.
Fields§
§krate: PathWhere ingraph lives, for the shelf every emitted path is rooted at.
vis: VisibilityThe declaration’s visibility, which the emitted struct takes.
name: IdentThe declared type’s own name.
width: BitWidthThe width the bits are stored at.
bits: Vec<FlagBit>The bits, in declaration order. Never empty.
attrs: Vec<Attribute>The declaration’s own non-ingraph attributes, forwarded onto the emitted struct in order.
This is how #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] reaches the type bitflags!
mints. It is not added for the author, for the vocabulary kind’s reason: a derive this door
injected would collide with one the author wrote, and the bound that actually needs it reports
E0277 naming the trait at the type.
remote: Option<Path>remote = "…" — the upstream flags set this declaration RESTATES, where it restates one.
None is the ordinary declaration and the emission is untouched by this axis, down to the
token: the mirror is written last and adds to what a declared set already emits rather than
forking it. See remote for the whole of what the word buys.
wire_name: Option<String>graphql(rename = "…") — what a SCHEMA calls this flags set, where the declaration moved it.
None is the Rust name unraw’d, which is what FlagsModel::sdl_name resolves. EMISSION-ONLY,
for EnumModel’s reason: the bitflags! type keeps its name,
every bit keeps its const, and a stored bit pattern has no word for this to move.
Implementations§
Source§impl FlagsModel
impl FlagsModel
Sourcepub fn sdl_name(&self) -> String
pub fn sdl_name(&self) -> String
The name a SCHEMA publishes this type under — the declaration’s
wire_name, else the Rust name unraw’d.
THE ONE HOME OF THIS KIND’S WHOLE SDL FAMILY. Three published names are built off this
string and none of them is spelled twice: the OBJECT face takes it verbatim, the operand SCALAR
is <it>Input and the filter input object is <it>Filter, each composed where it is registered
rather than here. So one word moves the family and the three cannot come to disagree — which is
the same property the derivation was built for before there was a word to move it.
The knob arrived with the rename-parity ruling, replacing this function’s own
no rename knob, for EnumModel’s reason — and the two names moved together, as the sentence
promised they would.
Sourcepub fn emit(&self) -> TokenStream
pub fn emit(&self) -> TokenStream
The whole expansion: the bitflags! type, then the rows, then the two wire seats — and, for a
MIRROR, the crossing to its upstream behind all of it.
§The mirror is an ADDITION and never a fork
A mirrored flags set is a flags set: it mints its own bitflags! type, stores its own bit
pattern, publishes its own object face and reads its own bit table. So remote = "…" buys
one more block at the END of the expansion and moves nothing in front of it —
which is what makes a declaration naming no upstream emit exactly what it emitted before the
axis existed, token for token, and is why there is no second emitter to keep in step with this
one.
That is the whole of where this kind departs from the vocabulary’s mirror mode, and the arity
is the reason: an enum mirror DELEGATES its words to the upstream’s Display, so its emission
really is a second one; a flags mirror delegates nothing, because a bit pattern is the same
number on both sides of the crossing.