Struct apollo_encoder::UnionDefinition
source · pub struct UnionDefinition { /* private fields */ }
Expand description
UnionDefinitions are an abstract type where no common fields are declared.
UnionDefTypeDefinition: Description? union Name Directives? UnionDefMemberTypes?
Detailed documentation can be found in GraphQL spec.
Example
use apollo_encoder::UnionDefinition;
let mut union_ = UnionDefinition::new("Pet".to_string());
union_.member("Cat".to_string());
union_.member("Dog".to_string());
assert_eq!(
union_.to_string(),
r#"union Pet = Cat | Dog
"#
);
Implementations
sourceimpl UnionDefinition
impl UnionDefinition
sourcepub fn description(&mut self, description: String)
pub fn description(&mut self, description: String)
Set the UnionDefs description.
Trait Implementations
sourceimpl Clone for UnionDefinition
impl Clone for UnionDefinition
sourcefn clone(&self) -> UnionDefinition
fn clone(&self) -> UnionDefinition
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for UnionDefinition
impl Debug for UnionDefinition
sourceimpl Display for UnionDefinition
impl Display for UnionDefinition
sourceimpl PartialEq<UnionDefinition> for UnionDefinition
impl PartialEq<UnionDefinition> for UnionDefinition
sourcefn eq(&self, other: &UnionDefinition) -> bool
fn eq(&self, other: &UnionDefinition) -> bool
sourceimpl TryFrom<UnionTypeDefinition> for UnionDefinition
impl TryFrom<UnionTypeDefinition> for UnionDefinition
sourcefn try_from(node: UnionTypeDefinition) -> Result<Self, Self::Error>
fn try_from(node: UnionTypeDefinition) -> Result<Self, Self::Error>
Create an apollo-encoder node from an apollo-parser one.
Errors
This returns an error if the apollo-parser tree is not valid. The error doesn’t have much context due to TryFrom API constraints: validate the parse tree before using TryFrom if granular errors are important to you.
type Error = FromError
type Error = FromError
sourceimpl TryFrom<UnionTypeExtension> for UnionDefinition
impl TryFrom<UnionTypeExtension> for UnionDefinition
sourcefn try_from(node: UnionTypeExtension) -> Result<Self, Self::Error>
fn try_from(node: UnionTypeExtension) -> Result<Self, Self::Error>
Create an apollo-encoder node from an apollo-parser one.
Errors
This returns an error if the apollo-parser tree is not valid. The error doesn’t have much context due to TryFrom API constraints: validate the parse tree before using TryFrom if granular errors are important to you.