pub struct UnionModel {
pub krate: Path,
pub vis: Visibility,
pub name: Ident,
pub members: Vec<UnionMember>,
pub error: Option<Ident>,
pub graphql: Vec<UnionSkin>,
}Expand description
One union’s declaration, validated.
Public fields for the reason RecordModel’s are: nothing here
parses, so a front end that is not the derive builds the same struct and reaches the same
emitter.
Fields§
§krate: PathWhere ingraph lives, for every path the WIRE half emits. The method face names none.
vis: VisibilityThe declaration’s visibility, which every emitted item takes.
name: IdentThe declared enum’s own name.
members: Vec<UnionMember>Its members, in declaration order. Never empty, and never two of one type.
error: Option<Ident>What the emitted REFUSAL type is called, when the declaration named it.
None is <Union>UnwrapError, which is what UnionModel::error resolves.
graphql: Vec<UnionSkin>The backends this union is dressed for, in declaration order. EMPTY is a union with no wire
face at all, which is what a declaration writing no graphql(…) block keeps.
Implementations§
Source§impl UnionModel
impl UnionModel
Sourcepub fn error(&self) -> Ident
pub fn error(&self) -> Ident
The refusal type a wrong-variant unwrap answers with — the declared name, else
FoundUnwrapError.
The ONE authority on what that type is called: the emission writes this, and a front end’s collision check asks it rather than rebuilding the suffix convention on its own side.
Sourcepub fn emit(&self) -> TokenStream
pub fn emit(&self) -> TokenStream
The whole expansion: the refusal type, the method face, and the wire faces a declaration asked for.
The WIRE half is a block of its own rather than a member of the seam’s, for the reason
EnumModel::emit keeps its own separate: the whole of
it sits behind the binding gate, and a gate wrapping one block’s entire body is what lets a
build without async-graphql expand it to nothing at all.
It is also what keeps the SEAM untouched. [Equipped] is shared with the interface derive,
which has a wire face of its own and no use for this one — so the union’s backend impls hang
off the MODEL, one layer above the emission both member sets reach.