pub struct Operation<QueryFragment, Variables = ()> {
pub query: String,
pub variables: Variables,
pub operation_name: Option<Cow<'static, str>>,
/* private fields */
}
Expand description
An Operation that can be sent to a remote GraphQL server.
This contains a GraphQL query string and variable HashMap. It can be
serialized into JSON with serde::Serialize
and sent to a remote server.
Fields§
§query: String
The graphql query string that will be sent to the server
variables: Variables
The variables that will be sent to the server as part of this operation
operation_name: Option<Cow<'static, str>>
The name of the operation in query that we should run
Implementations§
source§impl<Fragment, Variables> Operation<Fragment, Variables>where
Fragment: QueryFragment,
Variables: QueryVariables,
impl<Fragment, Variables> Operation<Fragment, Variables>where
Fragment: QueryFragment,
Variables: QueryVariables,
sourcepub fn new(query: String, variables: Variables) -> Self
pub fn new(query: String, variables: Variables) -> Self
Constructs a new operation from a String & some variables.
This is useful for certain testing cirumstances, but offers no typesafety. crate::QueryBuilder, crate::MutationBuilder and crate::SubscriptionBuilder should be preferered.
sourcepub fn query(variables: Variables) -> Selfwhere
Fragment::SchemaType: QueryRoot,
pub fn query(variables: Variables) -> Selfwhere
Fragment::SchemaType: QueryRoot,
Constructs a new Operation for a query
sourcepub fn mutation(variables: Variables) -> Selfwhere
Fragment::SchemaType: MutationRoot,
pub fn mutation(variables: Variables) -> Selfwhere
Fragment::SchemaType: MutationRoot,
Constructs a new Operation for a mutation
Trait Implementations§
Auto Trait Implementations§
impl<QueryFragment, Variables> Freeze for Operation<QueryFragment, Variables>where
Variables: Freeze,
impl<QueryFragment, Variables> RefUnwindSafe for Operation<QueryFragment, Variables>where
Variables: RefUnwindSafe,
impl<QueryFragment, Variables> Send for Operation<QueryFragment, Variables>where
Variables: Send,
impl<QueryFragment, Variables> Sync for Operation<QueryFragment, Variables>where
Variables: Sync,
impl<QueryFragment, Variables> Unpin for Operation<QueryFragment, Variables>where
Variables: Unpin,
impl<QueryFragment, Variables> UnwindSafe for Operation<QueryFragment, Variables>where
Variables: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more