macro_rules! graphql_union {
( @as_item, $i:item) => { ... };
( @as_expr, $e:expr) => { ... };
( @as_path, $p:path) => { ... };
( @as_type, $t:ty) => { ... };
(
@ gather_meta,
($reg:expr, $acc:expr, $descr:expr),
description : $value:tt $( $rest:tt )*
) => { ... };
(
@ gather_meta,
($reg:expr, $acc:expr, $descr:expr),
instance_resolvers: | $ctxtvar:pat
| { $( $srctype:ty => $resolver:expr ),* $(,)* } $( $rest:tt )*
) => { ... };
(
@ concrete_type_name,
($outname:tt, $ctxtarg:ident, $ctxttype:ty),
instance_resolvers: | $ctxtvar:pat
| { $( $srctype:ty => $resolver:expr ),* $(,)* } $( $rest:tt )*
) => { ... };
(
@ resolve_into_type,
($outname:tt, $typenamearg:ident, $execarg:ident, $ctxttype:ty),
instance_resolvers: | $ctxtvar:pat
| { $( $srctype:ty => $resolver:expr ),* $(,)* } $( $rest:tt )*
) => { ... };
( @ $mfn:ident, $args:tt, , $($rest:tt)* ) => { ... };
( @ $mfn:ident, $args:tt, $item:tt $($rest:tt)* ) => { ... };
( @ $mfn:ident, $args:tt, ) => { ... };
(
( $($lifetime:tt),* ) $name:ty : $ctxt:ty as $outname:tt | &$mainself:ident | {
$( $items:tt )*
}
) => { ... };
(
<$($lifetime:tt),*> $name:ty : $ctxt:ty as $outname:tt | &$mainself:ident | {
$( $items:tt )*
}
) => { ... };
(
$name:ty : $ctxt:ty as $outname:tt | &$mainself:ident | {
$( $items:tt )*
}
) => { ... };
(
$name:ty : $ctxt:ty | &$mainself:ident | {
$( $items:tt )*
}
) => { ... };
}
Expose GraphQL unions
Like interfaces, mapping unions can be tricky in idiomatic Rust. Because of
their similarity, the helper macros are similar, too: you provide a set of
expressions that resolve the union into the actual concrete type.
See the documentation for graphql_object!
on the general item and type
syntax. graphql_union!
supports only description
and interface_resolvers
items, no fields or interfaces can be declared.
See the documentation for graphql_interface!
on the syntax for interface
resolvers.