Struct apollo_encoder::SchemaDefinition
source · [−]pub struct SchemaDefinition { /* private fields */ }
Expand description
A GraphQL service’s collective type system capabilities are referred to as that service’s “schema”.
SchemaDefinition: Description? schema Directives? { RootOperationTypeDefinition* }
Detailed documentation can be found in GraphQL spec.
Example
use apollo_encoder::{SchemaDefinition};
use indoc::indoc;
let mut schema_def = SchemaDefinition::new();
schema_def.query("TryingToFindCatQuery".to_string());
schema_def.mutation("MyMutation".to_string());
schema_def.subscription("MySubscription".to_string());
assert_eq!(
schema_def.to_string(),
indoc! { r#"
schema {
query: TryingToFindCatQuery
mutation: MyMutation
subscription: MySubscription
}
"#}
);
Implementations
sourceimpl SchemaDefinition
impl SchemaDefinition
sourcepub fn description(&mut self, description: Option<String>)
pub fn description(&mut self, description: Option<String>)
Set the SchemaDef’s description.
sourcepub fn subscription(&mut self, subscription: String)
pub fn subscription(&mut self, subscription: String)
Set the schema def’s subscription type.
Trait Implementations
sourceimpl Clone for SchemaDefinition
impl Clone for SchemaDefinition
sourcefn clone(&self) -> SchemaDefinition
fn clone(&self) -> SchemaDefinition
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 more
sourceimpl Debug for SchemaDefinition
impl Debug for SchemaDefinition
sourceimpl Default for SchemaDefinition
impl Default for SchemaDefinition
Auto Trait Implementations
impl RefUnwindSafe for SchemaDefinition
impl Send for SchemaDefinition
impl Sync for SchemaDefinition
impl Unpin for SchemaDefinition
impl UnwindSafe for SchemaDefinition
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more