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§
Source§impl UnionDefinition
impl UnionDefinition
Sourcepub fn description(&mut self, description: String)
pub fn description(&mut self, description: String)
Set the UnionDefs description.
Trait Implementations§
Source§impl Clone for UnionDefinition
impl Clone for UnionDefinition
Source§fn clone(&self) -> UnionDefinition
fn clone(&self) -> UnionDefinition
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for UnionDefinition
impl Debug for UnionDefinition
Source§impl Display for UnionDefinition
impl Display for UnionDefinition
Source§impl PartialEq for UnionDefinition
impl PartialEq for UnionDefinition
Source§impl TryFrom<UnionTypeDefinition> for UnionDefinition
impl TryFrom<UnionTypeDefinition> for UnionDefinition
Source§fn 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.
Source§impl TryFrom<UnionTypeExtension> for UnionDefinition
impl TryFrom<UnionTypeExtension> for UnionDefinition
Source§fn 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.