Struct apollo_encoder::Directive [−][src]
pub struct Directive { /* fields omitted */ }Expand description
The __Directive type represents a Directive that a service supports.
DirectiveDefinition: Description? directive @ Name Arguments Definition? repeatable? on DirectiveLocations
Detailed documentation can be found in GraphQL spec.
Example
use apollo_encoder::{Directive};
use indoc::indoc;
let mut directive = Directive::new("infer".to_string());
directive.description(Some("Infer field types\nfrom field values.".to_string()));
directive.location("OBJECT".to_string());
directive.location("FIELD_DEFINITION".to_string());
directive.location("INPUT_FIELD_DEFINITION".to_string());
assert_eq!(
directive.to_string(),
r#""""
Infer field types
from field values.
"""
directive @infer on OBJECT | FIELD_DEFINITION | INPUT_FIELD_DEFINITION
"#
);Implementations
Set the Directive’s description.
Set the Directive’s args.