[−][src]Enum juniper::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
Scalar(S)
Enum(String)
Variable(String)
List(Vec<Spanning<InputValue<S>>>)
Object(Vec<(Spanning<String>, Spanning<InputValue<S>>)>)
Methods
impl<S> InputValue<S> where
S: ScalarValue,
[src]
S: ScalarValue,
pub fn null() -> Self
[src]
Construct a null value.
pub fn int(i: i32) -> Self
[src]
Use InputValue::scalar
instead
Construct an integer value.
pub fn float(f: f64) -> Self
[src]
Use InputValue::scalar
instead
Construct a floating point value.
pub fn boolean(b: bool) -> Self
[src]
Use InputValue::scalar
instead
Construct a boolean value.
pub fn string<T: AsRef<str>>(s: T) -> Self
[src]
Use InputValue::scalar
instead
Construct a string value.
pub fn scalar<T>(v: T) -> Self where
T: Into<S>,
[src]
T: Into<S>,
Construct a scalar value
pub fn enum_value<T: AsRef<str>>(s: T) -> Self
[src]
Construct an enum value.
pub fn variable<T: AsRef<str>>(v: T) -> Self
[src]
Construct a variable value.
pub fn list(l: Vec<Self>) -> Self
[src]
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.
pub fn parsed_list(l: Vec<Spanning<Self>>) -> Self
[src]
Construct a located list.
pub fn object<K>(o: IndexMap<K, Self>) -> Self where
K: AsRef<str> + Eq + Hash,
[src]
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.
pub fn parsed_object(o: Vec<(Spanning<String>, Spanning<Self>)>) -> Self
[src]
Construct a located object.
pub fn into_const(self, vars: &Variables<S>) -> Self
[src]
Resolve all variables to their values.
pub fn convert<T>(&self) -> Option<T> where
T: FromInputValue<S>,
&'b S: ScalarRefValue<'b>,
[src]
T: FromInputValue<S>,
&'b S: ScalarRefValue<'b>,
Shorthand form of invoking FromInputValue::from()
.
pub fn is_null(&self) -> bool
[src]
Does the value represent null?
pub fn is_variable(&self) -> bool
[src]
Does the value represent a variable?
pub fn as_enum_value(&self) -> Option<&str>
[src]
View the underlying enum value, if present.
pub fn as_int_value<'a>(&'a self) -> Option<i32> where
&'a S: Into<Option<&'a i32>>,
[src]
&'a S: Into<Option<&'a i32>>,
Use InputValue::as_scalar_value
instead
View the underlying int value, if present.
pub fn as_float_value<'a>(&'a self) -> Option<f64> where
&'a S: Into<Option<&'a f64>>,
[src]
&'a S: Into<Option<&'a f64>>,
Use InputValue::as_scalar_value
instead
View the underlying float value, if present.
pub fn as_string_value<'a>(&'a self) -> Option<&'a str> where
&'a S: Into<Option<&'a String>>,
[src]
&'a S: Into<Option<&'a String>>,
Use InputValue::as_scalar_value
instead
View the underlying string value, if present.
pub fn as_scalar(&self) -> Option<&S>
[src]
View the underlying scalar value, if present.
pub fn as_scalar_value<'a, T>(&'a self) -> Option<&'a T> where
T: 'a,
&'a S: Into<Option<&'a T>>,
[src]
T: 'a,
&'a S: Into<Option<&'a T>>,
View the underlying scalar value, if present.
pub fn to_object_value<'a>(&'a self) -> Option<IndexMap<&'a str, &'a Self>>
[src]
Convert the input value to an unlocated object value.
This constructs a new IndexMap that contain references to the keys
and values in self
.
pub fn to_list_value(&self) -> Option<Vec<&Self>>
[src]
Convert the input value to an unlocated list value.
This constructs a new vector that contain references to the values
in self
.
pub fn referenced_variables(&self) -> Vec<&str>
[src]
Recursively find all variables
pub fn unlocated_eq(&self, other: &Self) -> bool
[src]
Compare equality with another InputValue
ignoring any source position information.
Trait Implementations
impl<S: PartialEq> PartialEq<InputValue<S>> for InputValue<S>
[src]
fn eq(&self, other: &InputValue<S>) -> bool
[src]
fn ne(&self, other: &InputValue<S>) -> bool
[src]
impl<S: Clone> Clone for InputValue<S>
[src]
fn clone(&self) -> InputValue<S>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<S: Debug> Debug for InputValue<S>
[src]
impl<S> Display for InputValue<S> where
S: ScalarValue,
&'b S: ScalarRefValue<'b>,
[src]
S: ScalarValue,
&'b S: ScalarRefValue<'b>,
impl<T> Serialize for InputValue<T> where
T: ScalarValue,
[src]
T: ScalarValue,
impl<'de, S> Deserialize<'de> for InputValue<S> where
S: ScalarValue,
[src]
S: ScalarValue,
fn deserialize<D>(deserializer: D) -> Result<InputValue<S>, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
Auto Trait Implementations
impl<S> Send for InputValue<S> where
S: Send,
S: Send,
impl<S> Sync for InputValue<S> where
S: Sync,
S: Sync,
Blanket Implementations
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,