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
Performs the conversion.
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 T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcepub fn equivalent(&self, key: &K) -> bool
pub fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more