Struct apollo_encoder::InputValueDefinition
source · pub struct InputValueDefinition { /* private fields */ }
Expand description
The InputValueDefinition type represents field and directive arguments.
InputValueDefinition: Description? Name : Type DefaultValue? Directives?
Detailed documentation can be found in GraphQL spec.
Example
use apollo_encoder::{Type_, InputValueDefinition};
let ty_1 = Type_::NamedType {
name: "SpaceProgram".to_string(),
};
let ty_2 = Type_::List { ty: Box::new(ty_1) };
let mut value = InputValueDefinition::new("cat".to_string(), ty_2);
value.description("Very good cats".to_string());
assert_eq!(
value.to_string(),
r#"
"Very good cats"
cat: [SpaceProgram]"#
);
Implementations§
source§impl InputValueDefinition
impl InputValueDefinition
sourcepub fn description(&mut self, description: String)
pub fn description(&mut self, description: String)
Set the InputValueDefinition’s description.
sourcepub fn default_value(&mut self, default_value: String)
pub fn default_value(&mut self, default_value: String)
Set the InputValueDef’s default value.
Trait Implementations§
source§impl Clone for InputValueDefinition
impl Clone for InputValueDefinition
source§fn clone(&self) -> InputValueDefinition
fn clone(&self) -> InputValueDefinition
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for InputValueDefinition
impl Debug for InputValueDefinition
source§impl Display for InputValueDefinition
impl Display for InputValueDefinition
source§impl PartialEq<InputValueDefinition> for InputValueDefinition
impl PartialEq<InputValueDefinition> for InputValueDefinition
source§fn eq(&self, other: &InputValueDefinition) -> bool
fn eq(&self, other: &InputValueDefinition) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl TryFrom<InputValueDefinition> for InputValueDefinition
impl TryFrom<InputValueDefinition> for InputValueDefinition
source§fn try_from(node: InputValueDefinition) -> Result<Self, Self::Error>
fn try_from(node: InputValueDefinition) -> 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.