Skip to main content

UnionModel

Struct UnionModel 

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

Where ingraph lives, for every path the WIRE half emits. The method face names none.

§vis: Visibility

The declaration’s visibility, which every emitted item takes.

§name: Ident

The 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

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for UnionModel

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 UnionModel

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.