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 for InputValueDefinition
impl PartialEq for InputValueDefinition
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.
impl StructuralPartialEq for InputValueDefinition
Auto Trait Implementations§
impl Freeze for InputValueDefinition
impl RefUnwindSafe for InputValueDefinition
impl Send for InputValueDefinition
impl Sync for InputValueDefinition
impl Unpin for InputValueDefinition
impl UnwindSafe for InputValueDefinition
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more