pub struct FlagBit {
pub ident: Ident,
pub rename: Option<String>,
pub upstream: Option<Ident>,
pub value: u128,
pub attrs: Vec<Attribute>,
}Expand description
One declared bit.
Fields§
§ident: IdentThe bit as the MANIFEST spells it — the enum variant’s own identifier.
rename: Option<String>rename = "…" in the DECLARED mode, which moves the word every face spells this bit with.
A mirror’s rename fills upstream instead, the two knobs being one word
reading two ways: see that field for why a restatement has no word of its own to move.
upstream: Option<Ident>rename = "…" in the MIRROR mode — the upstream const this bit restates.
A mirror’s words are its OWN, where a mirrored vocabulary’s are the upstream’s, and the
asymmetry is the arity again: a flags set stores a bit PATTERN, so the mirrored type’s text
form is read off this crate’s bit table and never off the upstream’s. What a restatement can
get wrong is therefore not a word but a NUMBER, and the upstream const is what the drift pin
compares against.
value: u128The bit’s value, evaluated.
attrs: Vec<Attribute>The declaration’s own non-ingraph attributes, forwarded onto the emitted const in order —
which is what carries a bit’s doc comment into the expansion.
Implementations§
Source§impl FlagBit
impl FlagBit
Sourcepub fn word(&self) -> String
pub fn word(&self) -> String
The WORD this bit is spelled with: its rename, else its identifier SHOUTED.
One string serving three seats — the emitted const’s name, the strict text form’s token, and
the wire’s name-list entry — which is what keeps bitflags::parser::to_writer usable as the
text renderer instead of a second one written here.
The shout is a Rust CONVENTION rather than a stored-word decision, which is why this kind cases
where a vocabulary’s stored word is verbatim: an associated const is SCREAMING_SNAKE_CASE
everywhere in the ecosystem, and a flags column stores no word at all for a casing rule to
rewrite.
Sourcepub fn field(&self) -> String
pub fn field(&self) -> String
The wire FIELD this bit takes — its word, under GraphQL’s own casing.
Derived from word rather than from the identifier, so a rename moves both and
they stay two readings of one declaration.
Sourcepub fn upstream(&self) -> Ident
pub fn upstream(&self) -> Ident
The UPSTREAM const a mirror’s bit restates — the declared rename, else this bit’s own
constant.
The drift pin is written from this, so a name that answers to nothing upstream is E0599 at
the token that named it. That is the whole enforcement and it is the compiler’s: this side
cannot see the upstream declaration, and a table of upstream names kept here would be a second
copy of somebody else’s bitflags!.