Enum juniper::Type [−][src]
pub enum Type<'a> { Named(Cow<'a, str>), List(Box<Type<'a>>), NonNullNamed(Cow<'a, str>), NonNullList(Box<Type<'a>>), }
A type literal in the syntax tree
This enum carries no semantic information and might refer to types that do not exist.
Variants
Named(Cow<'a, str>)
A nullable named type, e.g. String
List(Box<Type<'a>>)
A nullable list type, e.g. [String]
The list itself is what's nullable, the containing type might be non-null.
NonNullNamed(Cow<'a, str>)
A non-null named type, e.g. String!
NonNullList(Box<Type<'a>>)
A non-null list type, e.g. [String]!
.
The list itself is what's non-null, the containing type might be null.
Methods
impl<'a> Type<'a>
[src]
impl<'a> Type<'a>
pub fn name(&self) -> Option<&str>
[src]
pub fn name(&self) -> Option<&str>
Get the name of a named type.
Only applies to named types; lists will return None
.
pub fn innermost_name(&self) -> &str
[src]
pub fn innermost_name(&self) -> &str
Get the innermost name by unpacking lists
All type literals contain exactly one named type.
pub fn is_non_null(&self) -> bool
[src]
pub fn is_non_null(&self) -> bool
Determines if a type only can represent non-null values.
Trait Implementations
impl<'a> Clone for Type<'a>
[src]
impl<'a> Clone for Type<'a>
fn clone(&self) -> Type<'a>
[src]
fn clone(&self) -> Type<'a>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<'a> Eq for Type<'a>
[src]
impl<'a> Eq for Type<'a>
impl<'a> PartialEq for Type<'a>
[src]
impl<'a> PartialEq for Type<'a>
fn eq(&self, other: &Type<'a>) -> bool
[src]
fn eq(&self, other: &Type<'a>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Type<'a>) -> bool
[src]
fn ne(&self, other: &Type<'a>) -> bool
This method tests for !=
.
impl<'a> Debug for Type<'a>
[src]
impl<'a> Debug for Type<'a>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<'a> Display for Type<'a>
[src]
impl<'a> Display for Type<'a>