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
sourceimpl 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
sourceimpl Clone for InputValueDefinition
impl Clone for InputValueDefinition
sourcefn clone(&self) -> InputValueDefinition
fn clone(&self) -> InputValueDefinition
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for InputValueDefinition
impl Debug for InputValueDefinition
sourceimpl Display for InputValueDefinition
impl Display for InputValueDefinition
sourceimpl PartialEq<InputValueDefinition> for InputValueDefinition
impl PartialEq<InputValueDefinition> for InputValueDefinition
sourcefn eq(&self, other: &InputValueDefinition) -> bool
fn eq(&self, other: &InputValueDefinition) -> bool
sourceimpl TryFrom<InputValueDefinition> for InputValueDefinition
impl TryFrom<InputValueDefinition> for InputValueDefinition
sourcefn 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.
type Error = FromError
type Error = FromError
The type returned in the event of a conversion error.
impl StructuralPartialEq for InputValueDefinition
Auto Trait Implementations
impl RefUnwindSafe for InputValueDefinition
impl Send for InputValueDefinition
impl Sync for InputValueDefinition
impl Unpin for InputValueDefinition
impl UnwindSafe for InputValueDefinition
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more