Struct cynic::Operation

source ·
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,

source

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.

source

pub fn query(variables: Variables) -> Selfwhere Fragment::SchemaType: QueryRoot,

Constructs a new Operation for a query

source

pub fn mutation(variables: Variables) -> Selfwhere Fragment::SchemaType: MutationRoot,

Constructs a new Operation for a mutation

Trait Implementations§

source§

impl<QueryFragment, Variables> Serialize for Operation<QueryFragment, Variables>where Variables: Serialize,

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> IsFieldType<T> for T