Enum juniper::Value
[−]
[src]
pub enum Value { Null, Int(i32), Float(f64), String(String), Boolean(bool), List(Vec<Value>), Object(HashMap<String, Value>), }
Serializable value returned from query and field execution.
Used by the execution engine and resolvers to build up the response
structure. Similar to the Json
type found in the serialize crate.
It is also similar to the InputValue
type, but can not contain enum
values or variables. Also, lists and objects do not contain any location
information since they are generated by resolving fields and values rather
than parsing a source query.
Variants
Null
Int(i32)
Float(f64)
String(String)
Boolean(bool)
List(Vec<Value>)
Object(HashMap<String, Value>)
Methods
impl Value
[src]
fn null() -> Value
Construct a null value.
fn int(i: i32) -> Value
Construct an integer value.
fn float(f: f64) -> Value
Construct a floating point value.
fn string<T: AsRef<str>>(s: T) -> Value
Construct a string value.
fn boolean(b: bool) -> Value
Construct a boolean value.
fn list(l: Vec<Value>) -> Value
Construct a list value.
fn object<K>(o: HashMap<K, Value>) -> Value where
K: AsRef<str> + Eq + Hash,
K: AsRef<str> + Eq + Hash,
Construct an object value.
fn is_null(&self) -> bool
Does this value represent null?
fn as_object_value(&self) -> Option<&HashMap<String, Value>>
View the underlying object value, if present.
fn as_mut_object_value(&mut self) -> Option<&mut HashMap<String, Value>>
Mutable view into the underlying object value, if present.
fn as_list_value(&self) -> Option<&Vec<Value>>
View the underlying list value, if present.
fn as_string_value(&self) -> Option<&str>
View the underlying string value, if present.
Trait Implementations
impl Debug for Value
[src]
impl PartialEq for Value
[src]
fn eq(&self, __arg_0: &Value) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Value) -> bool
This method tests for !=
.
impl ToInputValue for Value
[src]
fn to(&self) -> InputValue
Performs the conversion.