Enum async_graphql_value::Value
source · [−]pub enum Value {
Variable(Name),
Null,
Number(Number),
String(String),
Boolean(bool),
Binary(Bytes),
Enum(Name),
List(Vec<Value>),
Object(IndexMap<Name, Value>),
}
Expand description
A GraphQL value, for example 1
, $name
or "Hello World!"
. This is
ConstValue
with variables.
It can be serialized and deserialized. Enums will be converted to strings.
Attempting to serialize Upload
or Variable
will fail, and Enum
,
Upload
and Variable
cannot be deserialized.
Variants
Variable(Name)
A variable, without the $
.
Null
null
.
Number(Number)
A number.
String(String)
A string.
Boolean(bool)
A boolean.
Binary(Bytes)
A binary.
Enum(Name)
An enum. These are typically in SCREAMING_SNAKE_CASE
.
List(Vec<Value>)
A list of values.
Object(IndexMap<Name, Value>)
An object. This is a map of keys to values.
Implementations
sourceimpl Value
impl Value
sourcepub fn into_const_with<E>(
self,
f: impl FnMut(Name) -> Result<ConstValue, E>
) -> Result<ConstValue, E>
pub fn into_const_with<E>(
self,
f: impl FnMut(Name) -> Result<ConstValue, E>
) -> Result<ConstValue, E>
Attempt to convert the value into a const value by using a function to get a variable.
sourcepub fn into_const(self) -> Option<ConstValue>
pub fn into_const(self) -> Option<ConstValue>
Attempt to convert the value into a const value.
Will fail if the value contains variables.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
sourcefn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<ConstValue> for Value
impl From<ConstValue> for Value
sourcefn from(value: ConstValue) -> Self
fn from(value: ConstValue) -> Self
Converts to this type from the input type.
impl Eq for Value
impl StructuralEq for Value
impl StructuralPartialEq for Value
Auto Trait Implementations
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.