Struct async_graphql_parser::types::Type
source · Expand description
A GraphQL type, for example String or [String!]!.
Fields§
§base: BaseTypeThe base type.
nullable: boolWhether the type is nullable.
Implementations§
source§impl Type
impl Type
sourcepub fn new(ty: &str) -> Option<Self>
pub fn new(ty: &str) -> Option<Self>
Create a type from the type string.
Examples found in repository?
More examples
src/types/mod.rs (line 71)
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
pub fn new(ty: &str) -> Option<Self> {
let (nullable, ty) = if let Some(rest) = ty.strip_suffix('!') {
(false, rest)
} else {
(true, ty)
};
Some(Self {
base: if let Some(ty) = ty.strip_prefix('[') {
BaseType::List(Box::new(Self::new(ty.strip_suffix(']')?)?))
} else {
BaseType::Named(Name::new(ty))
},
nullable,
})
}Trait Implementations§
source§impl<'de> Deserialize<'de> for Type
impl<'de> Deserialize<'de> for Type
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Type
impl StructuralEq for Type
impl StructuralPartialEq for Type
Auto Trait Implementations§
impl RefUnwindSafe for Type
impl Send for Type
impl Sync for Type
impl Unpin for Type
impl UnwindSafe for Type
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.