Require query variables to be Copy
This commit is contained in:
parent
23ecce06d5
commit
07f95ddd17
|
@ -77,7 +77,7 @@ pub trait QueryUnwrap<Vars>: 'static + QueryBuilder<Vars> {
|
|||
// Generic function for running start.gg queries
|
||||
pub fn run_query<Builder, Vars>(vars: Vars, auth_token: &str) -> Option<Builder::Unwrapped>
|
||||
where
|
||||
Vars: Clone,
|
||||
Vars: Copy,
|
||||
Builder: QueryUnwrap<Vars>,
|
||||
Vars: Serialize,
|
||||
for<'de> Builder: Deserialize<'de>,
|
||||
|
@ -87,14 +87,14 @@ where
|
|||
let mut response = reqwest::blocking::Client::new()
|
||||
.post("https://api.start.gg/gql/alpha")
|
||||
.header("Authorization", String::from("Bearer ") + auth_token)
|
||||
.run_graphql(Builder::build(vars.clone()));
|
||||
.run_graphql(Builder::build(vars));
|
||||
|
||||
for _ in 1..10 {
|
||||
sleep(Duration::from_secs(2));
|
||||
response = reqwest::blocking::Client::new()
|
||||
.post("https://api.start.gg/gql/alpha")
|
||||
.header("Authorization", String::from("Bearer ") + auth_token)
|
||||
.run_graphql(Builder::build(vars.clone()));
|
||||
.run_graphql(Builder::build(vars));
|
||||
if response.is_ok() {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ pub type Teams<T> = Vec<Vec<T>>;
|
|||
|
||||
// Variables
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug, Clone)]
|
||||
#[derive(cynic::QueryVariables, Debug, Copy, Clone)]
|
||||
pub struct EventSetsVars {
|
||||
pub event: EventId,
|
||||
pub page: i32,
|
||||
|
|
|
@ -4,7 +4,7 @@ use schema::schema;
|
|||
|
||||
// Variables
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug, Clone)]
|
||||
#[derive(cynic::QueryVariables, Debug, Copy, Clone)]
|
||||
pub struct PlayerInfoVars {
|
||||
pub id: PlayerId,
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ use schema::schema;
|
|||
|
||||
// Variables
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug, Clone)]
|
||||
#[derive(cynic::QueryVariables, Debug, Copy, Clone)]
|
||||
pub struct VideogameSearchVars<'a> {
|
||||
pub name: &'a str,
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ use schema::schema;
|
|||
|
||||
// Variables
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug, Clone)]
|
||||
#[derive(cynic::QueryVariables, Debug, Copy, Clone)]
|
||||
pub struct TournamentEventsVars<'a> {
|
||||
// HACK: This should really be an optional variable, but there seems to be a
|
||||
// server-side bug that completely breaks everything when this isn't passed.
|
||||
|
|
Loading…
Reference in a new issue