pub struct MutationBuilder<'schema: 'fragreg, 'fragreg>(/* private fields */);Implementations§
Source§impl<'schema: 'fragreg, 'fragreg> MutationBuilder<'schema, 'fragreg>
impl<'schema: 'fragreg, 'fragreg> MutationBuilder<'schema, 'fragreg>
Sourcepub fn add_directive(
self,
annot: DirectiveAnnotation,
) -> Result<Self, MutationBuildError>
pub fn add_directive( self, annot: DirectiveAnnotation, ) -> Result<Self, MutationBuildError>
Add a DirectiveAnnotation after any previously added
DirectiveAnnotations.
Sourcepub fn add_selection(
self,
selection: Selection<'schema>,
) -> Result<Self, MutationBuildError>
pub fn add_selection( self, selection: Selection<'schema>, ) -> Result<Self, MutationBuildError>
Add a Selection after any previously added Selections.
Sourcepub fn add_variable(
self,
variable: Variable,
) -> Result<Self, MutationBuildError>
pub fn add_variable( self, variable: Variable, ) -> Result<Self, MutationBuildError>
Add a Variable after any previously added Variables.
Sourcepub fn build(self) -> Result<Mutation<'schema, 'fragreg>, MutationBuildError>
pub fn build(self) -> Result<Mutation<'schema, 'fragreg>, MutationBuildError>
Consume this MutationBuilder to produce a Mutation.
Sourcepub fn build_from_ast(
schema: &'schema Schema,
fragment_registry: &'fragreg FragmentRegistry<'schema>,
ast: &Mutation,
file_path: Option<&Path>,
) -> Result<Mutation<'schema, 'fragreg>, MutationBuildError>
pub fn build_from_ast( schema: &'schema Schema, fragment_registry: &'fragreg FragmentRegistry<'schema>, ast: &Mutation, file_path: Option<&Path>, ) -> Result<Mutation<'schema, 'fragreg>, MutationBuildError>
Produce a Mutation from a
ast::operation::Mutation.
Sourcepub fn build_from_file(
schema: &'schema Schema,
fragment_registry: &'fragreg FragmentRegistry<'schema>,
file_path: impl AsRef<Path>,
) -> Result<Mutation<'schema, 'fragreg>, MutationBuildError>
pub fn build_from_file( schema: &'schema Schema, fragment_registry: &'fragreg FragmentRegistry<'schema>, file_path: impl AsRef<Path>, ) -> Result<Mutation<'schema, 'fragreg>, MutationBuildError>
Produce a Mutation from a file on disk that whose contents contain
an
executable document
with only a single query defined in it.
If multiple operations are defined in the document, an error will be
returned. For cases where multiple operations may be defined in a single
document, use
ExecutableDocumentBuilder.
If the document contents include any fragment definitions, an error will be returned. For cases where operations and fragments may be defined together in a single document, use ’ExecutableDocumentBuilder`.
Sourcepub fn build_from_str(
schema: &'schema Schema,
fragment_registry: &'fragreg FragmentRegistry<'schema>,
file_path: Option<&Path>,
content: impl AsRef<str>,
) -> Result<Mutation<'schema, 'fragreg>, MutationBuildError>
pub fn build_from_str( schema: &'schema Schema, fragment_registry: &'fragreg FragmentRegistry<'schema>, file_path: Option<&Path>, content: impl AsRef<str>, ) -> Result<Mutation<'schema, 'fragreg>, MutationBuildError>
Produce a Mutation from a string whose contents contain a
document with only
a single query defined in it.
If multiple operations are defined in the document, an error will be
returned. For cases where multiple operations may be defined in a single
document, use
ExecutableDocumentBuilder.
If the document contents include any fragment definitions, an error will be returned. For cases where operations and fragments may be defined together in a single document, use ’ExecutableDocumentBuilder`.
Sourcepub fn from_ast(
schema: &'schema Schema,
fragment_registry: &'fragreg FragmentRegistry<'schema>,
ast: &Mutation,
file_path: Option<&Path>,
) -> Result<Self, MutationBuildError>
pub fn from_ast( schema: &'schema Schema, fragment_registry: &'fragreg FragmentRegistry<'schema>, ast: &Mutation, file_path: Option<&Path>, ) -> Result<Self, MutationBuildError>
Produce a MutationBuilder from a Mutation.
Sourcepub fn from_file(
schema: &'schema Schema,
fragment_registry: &'fragreg FragmentRegistry<'schema>,
file_path: impl AsRef<Path>,
) -> Result<Self, MutationBuildError>
pub fn from_file( schema: &'schema Schema, fragment_registry: &'fragreg FragmentRegistry<'schema>, file_path: impl AsRef<Path>, ) -> Result<Self, MutationBuildError>
Produce a MutationBuilder from a file on disk that whose contents
contain an
executable document
with only a single query defined in it.
If multiple operations are defined in the document, an error will be
returned. For cases where multiple operations may be defined in a single
document, use
ExecutableDocumentBuilder.
If the document contents include any fragment definitions, an error will be returned. For cases where operations and fragments may be defined together in a single document, use ’ExecutableDocumentBuilder`.
Sourcepub fn from_str(
schema: &'schema Schema,
fragment_registry: &'fragreg FragmentRegistry<'schema>,
content: impl AsRef<str>,
file_path: Option<&Path>,
) -> Result<Self, MutationBuildError>
pub fn from_str( schema: &'schema Schema, fragment_registry: &'fragreg FragmentRegistry<'schema>, content: impl AsRef<str>, file_path: Option<&Path>, ) -> Result<Self, MutationBuildError>
Produce a MutationBuilder from a string whose contents contain a
document with only
a single query defined in it.
If multiple operations are defined in the document, an error will be
returned. For cases where multiple operations may be defined in a single
document, use
ExecutableDocumentBuilder.
If the document contents include any fragment definitions, an error will be returned. For cases where operations and fragments may be defined together in a single document, use ’ExecutableDocumentBuilder`.
Sourcepub fn new(
schema: &'schema Schema,
fragment_registry: &'fragreg FragmentRegistry<'schema>,
) -> Self
pub fn new( schema: &'schema Schema, fragment_registry: &'fragreg FragmentRegistry<'schema>, ) -> Self
See [OperationBuilderTrait::new]
Sourcepub fn set_directives(
self,
directives: &[DirectiveAnnotation],
) -> Result<Self, MutationBuildError>
pub fn set_directives( self, directives: &[DirectiveAnnotation], ) -> Result<Self, MutationBuildError>
Set the list of DirectiveAnnotations.
NOTE: If any previous directives were added (either using this function
or MutationBuilder::add_directive()), they will be fully replaced by
the DirectiveAnnotations passed here.
Sourcepub fn set_name(self, name: Option<String>) -> Result<Self, MutationBuildError>
pub fn set_name(self, name: Option<String>) -> Result<Self, MutationBuildError>
Set the name of the Mutation.
Sourcepub fn set_variables(
self,
variables: Vec<Variable>,
) -> Result<Self, MutationBuildError>
pub fn set_variables( self, variables: Vec<Variable>, ) -> Result<Self, MutationBuildError>
Set the list of Variables.
NOTE: If any previous variables were added (either using this function
or MutationBuilder::add_variable()), they will be fully replaced by the
collection of variables passed here.
Trait Implementations§
Source§impl<'schema: 'fragreg, 'fragreg> Clone for MutationBuilder<'schema, 'fragreg>
impl<'schema: 'fragreg, 'fragreg> Clone for MutationBuilder<'schema, 'fragreg>
Source§fn clone(&self) -> MutationBuilder<'schema, 'fragreg>
fn clone(&self) -> MutationBuilder<'schema, 'fragreg>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'schema: 'fragreg, 'fragreg> Debug for MutationBuilder<'schema, 'fragreg>
impl<'schema: 'fragreg, 'fragreg> Debug for MutationBuilder<'schema, 'fragreg>
Source§impl<'schema: 'fragreg, 'fragreg> PartialEq for MutationBuilder<'schema, 'fragreg>
impl<'schema: 'fragreg, 'fragreg> PartialEq for MutationBuilder<'schema, 'fragreg>
Source§fn eq(&self, other: &MutationBuilder<'schema, 'fragreg>) -> bool
fn eq(&self, other: &MutationBuilder<'schema, 'fragreg>) -> bool
self and other values to be equal, and is used by ==.