From 07f95ddd17ab62b3ab719fc4b77e036eebe4a70a Mon Sep 17 00:00:00 2001 From: Kiana Sheibani Date: Mon, 2 Oct 2023 20:34:54 -0400 Subject: [PATCH] Require query variables to be Copy --- src/queries.rs | 6 +++--- src/queries/event_sets.rs | 2 +- src/queries/player_info.rs | 2 +- src/queries/search_games.rs | 2 +- src/queries/tournament_events.rs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/queries.rs b/src/queries.rs index 407d3da..cfbcf47 100644 --- a/src/queries.rs +++ b/src/queries.rs @@ -77,7 +77,7 @@ pub trait QueryUnwrap: 'static + QueryBuilder { // Generic function for running start.gg queries pub fn run_query(vars: Vars, auth_token: &str) -> Option where - Vars: Clone, + Vars: Copy, Builder: QueryUnwrap, 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; } diff --git a/src/queries/event_sets.rs b/src/queries/event_sets.rs index a7249e5..c0ef073 100644 --- a/src/queries/event_sets.rs +++ b/src/queries/event_sets.rs @@ -6,7 +6,7 @@ pub type Teams = Vec>; // Variables -#[derive(cynic::QueryVariables, Debug, Clone)] +#[derive(cynic::QueryVariables, Debug, Copy, Clone)] pub struct EventSetsVars { pub event: EventId, pub page: i32, diff --git a/src/queries/player_info.rs b/src/queries/player_info.rs index 12880c1..0d8085d 100644 --- a/src/queries/player_info.rs +++ b/src/queries/player_info.rs @@ -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, } diff --git a/src/queries/search_games.rs b/src/queries/search_games.rs index 9944745..1d40643 100644 --- a/src/queries/search_games.rs +++ b/src/queries/search_games.rs @@ -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, } diff --git a/src/queries/tournament_events.rs b/src/queries/tournament_events.rs index 939797c..9277abd 100644 --- a/src/queries/tournament_events.rs +++ b/src/queries/tournament_events.rs @@ -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.