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.

Reference.

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

Attempt to convert the value into a const value by using a function to get a variable.

Attempt to convert the value into a const value.

Will fail if the value contains variables.

Attempt to convert the value into JSON. This is equivalent to the TryFrom implementation.

Errors

Fails if serialization fails (see enum docs for more info).

Attempt to convert JSON into a value. This is equivalent to the TryFrom implementation.

Errors

Fails if deserialization fails (see enum docs for more info).

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Deserialize this value from the given Serde deserializer. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Serialize this value into the given Serde serializer. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.