From a171d0e8dded9ee2ffae7612140b21e386a95d68 Mon Sep 17 00:00:00 2001 From: OMGeeky Date: Sat, 21 Oct 2023 01:58:00 +0200 Subject: [PATCH 1/4] Add Debug derive to Scope enum Adding that makes logging and debugging easier. --- gen/youtube3/src/api.rs | 2 +- src/generator/templates/api/lib/lib.mako | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gen/youtube3/src/api.rs b/gen/youtube3/src/api.rs index 8ad6daa170..5718de7d9b 100644 --- a/gen/youtube3/src/api.rs +++ b/gen/youtube3/src/api.rs @@ -23,7 +23,7 @@ use crate::{client, client::GetToken, client::serde_with}; /// Identifies the an OAuth2 authorization scope. /// A scope is needed when requesting an /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). -#[derive(PartialEq, Eq, Hash)] +#[derive(PartialEq, Eq, Hash, Debug)] pub enum Scope { /// Manage your YouTube account Full, diff --git a/src/generator/templates/api/lib/lib.mako b/src/generator/templates/api/lib/lib.mako index f7f407a164..71ff2eac5d 100644 --- a/src/generator/templates/api/lib/lib.mako +++ b/src/generator/templates/api/lib/lib.mako @@ -331,7 +331,7 @@ You can read the full text at the repository's [license file][repo-license]. /// Identifies the an OAuth2 authorization scope. /// A scope is needed when requesting an /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). -#[derive(PartialEq, Eq, Hash)] +#[derive(PartialEq, Eq, Hash, Debug)] pub enum Scope { % for url, scope in auth.oauth2.scopes.items(): ${scope.description | rust_doc_sanitize(documentationLink), rust_doc_comment} From aa8b90002ed9b82370169b479d4c786ab5476270 Mon Sep 17 00:00:00 2001 From: OMGeeky Date: Sat, 21 Oct 2023 02:55:26 +0200 Subject: [PATCH 2/4] Add Clone derive to Scope enum --- gen/youtube3/src/api.rs | 2 +- src/generator/templates/api/lib/lib.mako | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gen/youtube3/src/api.rs b/gen/youtube3/src/api.rs index 5718de7d9b..a3071263ae 100644 --- a/gen/youtube3/src/api.rs +++ b/gen/youtube3/src/api.rs @@ -23,7 +23,7 @@ use crate::{client, client::GetToken, client::serde_with}; /// Identifies the an OAuth2 authorization scope. /// A scope is needed when requesting an /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). -#[derive(PartialEq, Eq, Hash, Debug)] +#[derive(PartialEq, Eq, Hash, Debug, Clone)] pub enum Scope { /// Manage your YouTube account Full, diff --git a/src/generator/templates/api/lib/lib.mako b/src/generator/templates/api/lib/lib.mako index 71ff2eac5d..477d27bda8 100644 --- a/src/generator/templates/api/lib/lib.mako +++ b/src/generator/templates/api/lib/lib.mako @@ -331,7 +331,7 @@ You can read the full text at the repository's [license file][repo-license]. /// Identifies the an OAuth2 authorization scope. /// A scope is needed when requesting an /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). -#[derive(PartialEq, Eq, Hash, Debug)] +#[derive(PartialEq, Eq, Hash, Debug, Clone)] pub enum Scope { % for url, scope in auth.oauth2.scopes.items(): ${scope.description | rust_doc_sanitize(documentationLink), rust_doc_comment} From 8895ac698fd7eabebdb3ae7355d21a71bb4c3549 Mon Sep 17 00:00:00 2001 From: OMGeeky Date: Sun, 22 Oct 2023 13:48:29 +0200 Subject: [PATCH 3/4] remove changes from generated file --- gen/youtube3/src/api.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gen/youtube3/src/api.rs b/gen/youtube3/src/api.rs index a3071263ae..8ad6daa170 100644 --- a/gen/youtube3/src/api.rs +++ b/gen/youtube3/src/api.rs @@ -23,7 +23,7 @@ use crate::{client, client::GetToken, client::serde_with}; /// Identifies the an OAuth2 authorization scope. /// A scope is needed when requesting an /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). -#[derive(PartialEq, Eq, Hash, Debug, Clone)] +#[derive(PartialEq, Eq, Hash)] pub enum Scope { /// Manage your YouTube account Full, From c30df00f350b4cee6c1e4e42569c8b817b7e53b2 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sun, 22 Oct 2023 15:34:28 +0200 Subject: [PATCH 4/4] Add even more derived traits to `Scope` --- src/generator/templates/api/lib/lib.mako | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/generator/templates/api/lib/lib.mako b/src/generator/templates/api/lib/lib.mako index 477d27bda8..cb0ac09d50 100644 --- a/src/generator/templates/api/lib/lib.mako +++ b/src/generator/templates/api/lib/lib.mako @@ -331,7 +331,7 @@ You can read the full text at the repository's [license file][repo-license]. /// Identifies the an OAuth2 authorization scope. /// A scope is needed when requesting an /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). -#[derive(PartialEq, Eq, Hash, Debug, Clone)] +#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)] pub enum Scope { % for url, scope in auth.oauth2.scopes.items(): ${scope.description | rust_doc_sanitize(documentationLink), rust_doc_comment}