macro_rules! graphql_vars {
(@object $object:ident () () ()) => { ... };
(@object $object:ident [$($key:tt)+] ($value:expr) , $($rest:tt)*) => { ... };
(@object $object:ident [$($key:tt)+] ($value:expr) $unexpected:tt $($rest:tt)*) => { ... };
(@object $object:ident [$($key:tt)+] ($value:expr)) => { ... };
(@object $object:ident ($($key:tt)+) (: null $($rest:tt)*) $copy:tt) => { ... };
(@object $object:ident ($($key:tt)+) (: None $($rest:tt)*) $copy:tt) => { ... };
(@object $object:ident ($($key:tt)+) (: @$var:ident $($rest:tt)*) $copy:tt) => { ... };
(@object $object:ident ($($key:tt)+) (: [$($array:tt)*] $($rest:tt)*) $copy:tt) => { ... };
(@object $object:ident ($($key:tt)+) (: {$($map:tt)*} $($rest:tt)*) $copy:tt) => { ... };
(@object $object:ident ($($key:tt)+) (: $ident:ident , $($rest:tt)*) $copy:tt) => { ... };
(@object $object:ident ($($key:tt)+) (: $last:ident ) $copy:tt) => { ... };
(@object $object:ident ($($key:tt)+) (: $value:expr , $($rest:tt)*) $copy:tt) => { ... };
(@object $object:ident ($($key:tt)+) (: $value:expr) $copy:tt) => { ... };
(@object $object:ident ($($key:tt)+) (:) $copy:tt) => { ... };
(@object $object:ident ($($key:tt)+) () $copy:tt) => { ... };
(@object $object:ident () (: $($rest:tt)*) ($colon:tt $($copy:tt)*)) => { ... };
(@object $object:ident ($($key:tt)*) (, $($rest:tt)*) ($comma:tt $($copy:tt)*)) => { ... };
(@object $object:ident () (($key:expr) : $($rest:tt)*) $copy:tt) => { ... };
(@object $object:ident ($($key:tt)*) (: $($unexpected:tt)+) $copy:tt) => { ... };
(@object $object:ident ($($key:tt)*) ($tt:tt $($rest:tt)*) $copy:tt) => { ... };
(@unexpected) => { ... };
() => { ... };
( $($map:tt)+ ) => { ... };
}
Expand description
Constructs Variables
via JSON-like syntax.
Variables
key should implement Into
<
String
>
.
let code = 200;
let features = vec!["key", "value"];
let key: Cow<'static, str> = "key".into();
let value: Variables = graphql_vars! {
"code": code,
"success": code == 200,
features[0]: features[1],
key: @var,
};
See graphql_input_value!
for more info on syntax of value after :
.