Enum juniper::InputValue
[−]
[src]
pub enum InputValue { Null, Int(i64), Float(f64), String(String), Boolean(bool), Enum(String), Variable(String), List(Vec<Spanning<InputValue>>), Object(Vec<(Spanning<String>, Spanning<InputValue>)>), }
A JSON-like value that can be passed into the query execution, either out-of-band, or in-band as default variable values. These are not constant and might contain variables.
Lists and objects variants are spanned, i.e. they contain a reference to their position in the source file, if available.
Variants
Null
Int(i64)
Float(f64)
String(String)
Boolean(bool)
Enum(String)
Variable(String)
List(Vec<Spanning<InputValue>>)
Object(Vec<(Spanning<String>, Spanning<InputValue>)>)
Methods
impl InputValue
[src]
fn null() -> InputValue
Construct a null value.
fn int(i: i64) -> InputValue
Construct an integer value.
fn float(f: f64) -> InputValue
Construct a floating point value.
fn boolean(b: bool) -> InputValue
Construct a boolean value.
fn string<T: AsRef<str>>(s: T) -> InputValue
Construct a string value.
fn enum_value<T: AsRef<str>>(s: T) -> InputValue
Construct an enum value.
fn variable<T: AsRef<str>>(v: T) -> InputValue
Construct a variable value.
fn list(l: Vec<InputValue>) -> InputValue
Construct an unlocated list.
Convenience function to make each InputValue
in the input vector
not contain any location information. Can be used from ToInputValue
implementations, where no source code position information is available.
fn parsed_list(l: Vec<Spanning<InputValue>>) -> InputValue
Construct a located list.
fn object<K>(o: HashMap<K, InputValue>) -> InputValue where K: AsRef<str> + Eq + Hash
Construct an unlocated object.
Similar to InputValue::list
, it makes each key and value in the given
hash map not contain any location information.
fn parsed_object(o: Vec<(Spanning<String>, Spanning<InputValue>)>) -> InputValue
Construct a located object.
fn from_json(json: Json) -> InputValue
Convert a Json
structure into an InputValue
.
This consumes the JSON instance.
Notes: * No enums or variables will be produced by this method. * All lists and objects will be unlocated
fn into_const(self, vars: &HashMap<String, InputValue>) -> InputValue
Resolve all variables to their values.
fn convert<T>(&self) -> Option<T> where T: FromInputValue
Shorthand form of invoking FromInputValue::from()
.
fn is_null(&self) -> bool
Does the value represent null?
fn is_variable(&self) -> bool
Does the value represent a variable?
fn as_enum_value(&self) -> Option<&str>
View the underlying enum value, if present.
fn as_int_value(&self) -> Option<i64>
View the underlying int value, if present.
fn as_string_value(&self) -> Option<&str>
View the underlying string value, if present.
fn to_object_value(&self) -> Option<HashMap<&str, &InputValue>>
Convert the input value to an unlocated object value.
This constructs a new hashmap that contain references to the keys
and values in self
.
fn to_list_value(&self) -> Option<Vec<&InputValue>>
Convert the input value to an unlocated list value.
This constructs a new vector that contain references to the values
in self
.
fn referenced_variables(&self) -> Vec<&str>
Recursively find all variables
fn unlocated_eq(&self, other: &InputValue) -> bool
Compare equality with another InputValue
ignoring any source position information.
Trait Implementations
impl Clone for InputValue
[src]
fn clone(&self) -> InputValue
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl PartialEq for InputValue
[src]
fn eq(&self, __arg_0: &InputValue) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &InputValue) -> bool
This method tests for !=
.