[−][src]Trait artemis::exchange::Exchange
The main trait that must be implemented by exchanges
Required methods
#[must_use]fn run<'life0, 'async_trait, Q: GraphQLQuery, C: Client>(
&'life0 self,
operation: Operation<Q::Variables>,
client: C
) -> Pin<Box<dyn Future<Output = ExchangeResult<Q::ResponseData>> + Send + 'async_trait>> where
Q: 'async_trait,
C: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
&'life0 self,
operation: Operation<Q::Variables>,
client: C
) -> Pin<Box<dyn Future<Output = ExchangeResult<Q::ResponseData>> + Send + 'async_trait>> where
Q: 'async_trait,
C: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
Process a query operation.
Note that this can return early, perhaps partial results to subscriptions via client.push_result()
,
but this will do nothing for regular requests. The exchange should have a workflow in the style of:
Determine if this exchange can return a result -> Delegate to next
if not -> Perform processing on the delegated result -> Return result
For examples, see the built-in exchanges.
Arguments
operation
- the operation to be handled.client
- the client object for rerunning queries and pushing results if applicable.
Returns
Ok(Response)
if the operation was completed successfullyErr(YourError)
if there was an error anywhere. Errors fromnext
should be passed through. This will be displayed to the user, so make sure the error messages are reasonable.
Implementors
impl Exchange for FetchExchange
[src]
fn run<'life0, 'async_trait, Q: GraphQLQuery, C: Client>(
&'life0 self,
operation: Operation<Q::Variables>,
_client: C
) -> Pin<Box<dyn Future<Output = ExchangeResult<Q::ResponseData>> + Send + 'async_trait>> where
Q: 'async_trait,
C: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
operation: Operation<Q::Variables>,
_client: C
) -> Pin<Box<dyn Future<Output = ExchangeResult<Q::ResponseData>> + Send + 'async_trait>> where
Q: 'async_trait,
C: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
impl Exchange for TerminatorExchange
[src]
fn run<'life0, 'async_trait, Q: GraphQLQuery, C: Client>(
&'life0 self,
_operation: Operation<Q::Variables>,
_client: C
) -> Pin<Box<dyn Future<Output = ExchangeResult<Q::ResponseData>> + Send + 'async_trait>> where
Q: 'async_trait,
C: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
_operation: Operation<Q::Variables>,
_client: C
) -> Pin<Box<dyn Future<Output = ExchangeResult<Q::ResponseData>> + Send + 'async_trait>> where
Q: 'async_trait,
C: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,