Skip to main content

FlagsModel

Struct FlagsModel 

Source
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: Path

Where ingraph lives, for the shelf every emitted path is rooted at.

§vis: Visibility

The declaration’s visibility, which the emitted struct takes.

§name: Ident

The declared type’s own name.

§width: BitWidth

The 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

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for FlagsModel

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FlagsModel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.