Struct apollo_encoder::InputField
source · pub struct InputField { /* private fields */ }
Expand description
Input Field in a given Input Object. A GraphQL Input Object defines a set of input fields; the input fields are either scalars, enums, or other input objects. Input fields are similar to Fields, but can have a default value.
Example
use apollo_encoder::{Type_, InputField};
let ty_1 = Type_::NamedType {
name: "CatBreed".to_string(),
};
let mut field = InputField::new("cat".to_string(), ty_1);
field.default_value("\"Norwegian Forest\"".to_string());
assert_eq!(field.to_string(), r#" cat: CatBreed = "Norwegian Forest""#);
Implementations
sourceimpl InputField
impl InputField
sourcepub fn description(&mut self, description: String)
pub fn description(&mut self, description: String)
Set the InputField’s description.
sourcepub fn default_value(&mut self, default_value: String)
pub fn default_value(&mut self, default_value: String)
Set the InputField’s default value.
Trait Implementations
sourceimpl Clone for InputField
impl Clone for InputField
sourcefn clone(&self) -> InputField
fn clone(&self) -> InputField
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 InputField
impl Debug for InputField
sourceimpl Display for InputField
impl Display for InputField
sourceimpl PartialEq<InputField> for InputField
impl PartialEq<InputField> for InputField
sourcefn eq(&self, other: &InputField) -> bool
fn eq(&self, other: &InputField) -> bool
sourceimpl TryFrom<InputValueDefinition> for InputField
impl TryFrom<InputValueDefinition> for InputField
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 InputField
Auto Trait Implementations
impl RefUnwindSafe for InputField
impl Send for InputField
impl Sync for InputField
impl Unpin for InputField
impl UnwindSafe for InputField
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