Struct apollo_encoder::Field
source · pub struct Field { /* private fields */ }
Expand description
The __Field type represents each field in an Object or Interface type.
Field: Alias? Name Arguments? Directives? SelectionSet?
Detailed documentation can be found in GraphQL spec.
Example
use apollo_encoder::Field;
let mut field = Field::new("myField".to_string());
field.alias(Some("myAlias".to_string()));
assert_eq!(field.to_string(), r#"myAlias: myField"#);
Implementations
sourceimpl Field
impl Field
sourcepub fn selection_set(&mut self, selection_set: Option<SelectionSet>)
pub fn selection_set(&mut self, selection_set: Option<SelectionSet>)
Set a selection set to a field
Trait Implementations
sourceimpl TryFrom<Field> for Field
impl TryFrom<Field> for Field
sourcefn try_from(node: Field) -> Result<Self, Self::Error>
fn try_from(node: Field) -> 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 Field
Auto Trait Implementations
impl RefUnwindSafe for Field
impl Send for Field
impl Sync for Field
impl Unpin for Field
impl UnwindSafe for Field
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