Enum juniper::Nullable [−][src]
pub enum Nullable<T> { ImplicitNull, ExplicitNull, Some(T), }
Expand description
Nullable
can be used in situations where you need to distinguish between an implicitly and
explicitly null input value.
The GraphQL spec states that these two field calls are similar, but are not identical:
{
field(arg: null)
field
}
The first has explicitly provided null to the argument “arg”, while the second has implicitly not provided a value to the argument “arg”. These two forms may be interpreted differently. For example, a mutation representing deleting a field vs not altering a field, respectively.
In cases where you do not need to be able to distinguish between the two types of null, you
should simply use Option<T>
.
Variants
No value
No value, explicitly specified to be null
Some value T
Implementations
Returns true
if the nullable is a ExplicitNull
value.
Returns true
if the nullable is a ImplicitNull
value.
Converts from &mut Nullable<T>
to Nullable<&mut T>
.
Returns the contained Some
value, consuming the self
value.
Panics
Panics if the value is not a Some
with a custom panic message provided by msg
.
Returns the contained Some
value or computes it from a closure.
Maps a Nullable<T>
to Nullable<U>
by applying a function to a contained value.
Applies a function to the contained value (if any), or returns the provided default (if not).
Applies a function to the contained value (if any), or computes a default (if not).
Transforms the Nullable<T>
into a Result<T, E>
, mapping Some(v)
to Ok(v)
and
ImplicitNull
or ExplicitNull
to Err(err)
.
Transforms the Nullable<T>
into a Result<T, E>
, mapping Some(v)
to Ok(v)
and
ImplicitNull
or ExplicitNull
to Err(err())
.
Returns the nullable if it contains a value, otherwise returns b
.
Returns the nullable if it contains a value, otherwise calls f
and
returns the result.
Replaces the actual value in the nullable by the value given in parameter, returning the
old value if present, leaving a Some
in its place without deinitializing either one.
Trait Implementations
Performs the conversion.
Performs the conversion from an absent value (e.g. to distinguish between implicit and
explicit null). The default implementation just uses from_input_value
as if an explicit
null were provided. This conversion must not fail. Read more
Context type for this GraphQLValue
. Read more
Type that may carry additional schema information for this GraphQLValue
. Read more
Returns name of the GraphQLType
exposed by this GraphQLValue
. Read more
Resolves the provided selection_set
against this GraphQLValue
. Read more
fn resolve_field(
&self,
_info: &Self::TypeInfo,
_field_name: &str,
_arguments: &Arguments<'_, S>,
_executor: &Executor<'_, '_, Self::Context, S>
) -> ExecutionResult<S>
fn resolve_field(
&self,
_info: &Self::TypeInfo,
_field_name: &str,
_arguments: &Arguments<'_, S>,
_executor: &Executor<'_, '_, Self::Context, S>
) -> ExecutionResult<S>
Resolves the value of a single field on this GraphQLValue
. Read more
Resolves this GraphQLValue
(being an interface or an union) into a concrete
downstream object type. Read more
Returns the concrete GraphQLType
name for this GraphQLValue
being an interface,
an union or an object. Read more
impl<S, T> GraphQLValueAsync<S> for Nullable<T> where
T: GraphQLValueAsync<S>,
T::TypeInfo: Sync,
T::Context: Sync,
S: ScalarValue + Send + Sync,
impl<S, T> GraphQLValueAsync<S> for Nullable<T> where
T: GraphQLValueAsync<S>,
T::TypeInfo: Sync,
T::Context: Sync,
S: ScalarValue + Send + Sync,
Resolves the provided selection_set
against this GraphQLValueAsync
. Read more
fn resolve_field_async<'a>(
&'a self,
_info: &'a Self::TypeInfo,
_field_name: &'a str,
_arguments: &'a Arguments<'_, S>,
_executor: &'a Executor<'_, '_, Self::Context, S>
) -> BoxFuture<'a, ExecutionResult<S>>
fn resolve_field_async<'a>(
&'a self,
_info: &'a Self::TypeInfo,
_field_name: &'a str,
_arguments: &'a Arguments<'_, S>,
_executor: &'a Executor<'_, '_, Self::Context, S>
) -> BoxFuture<'a, ExecutionResult<S>>
Resolves the value of a single field on this GraphQLValueAsync
. Read more
Resolves this GraphQLValueAsync
(being an interface or an union) into a
concrete downstream object type. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Performs the conversion.
Auto Trait Implementations
impl<T> RefUnwindSafe for Nullable<T> where
T: RefUnwindSafe,
impl<T> UnwindSafe for Nullable<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.
pub fn vzip(self) -> V