diff --git a/src/client/response.rs b/src/client/response.rs index 47a54cc..8f00329 100644 --- a/src/client/response.rs +++ b/src/client/response.rs @@ -21,7 +21,7 @@ pub trait FromResponse: Sized { } /// Response parse errors. -#[derive(Debug, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum ParseError { /// Expected response to be of type. ExpectedType(&'static str), @@ -56,7 +56,7 @@ impl Error for ParseError { } /// JSON helper for response parsing. -#[derive(Debug)] +#[derive(Debug, Clone, Copy, PartialEq)] pub struct JsonHelper<'a>(pub &'a Json); impl<'a> JsonHelper<'a> { @@ -69,7 +69,7 @@ impl<'a> JsonHelper<'a> { } /// JSON object helper for response parsing. -#[derive(Debug)] +#[derive(Debug, Clone, Copy, PartialEq)] pub struct JsonObjectHelper<'a>(pub &'a json::Object); impl<'a> JsonObjectHelper<'a> { diff --git a/src/error.rs b/src/error.rs index 7d65502..8479438 100644 --- a/src/error.rs +++ b/src/error.rs @@ -10,7 +10,7 @@ use client::response::{FromResponse, ParseError, JsonHelper}; /// OAuth 2.0 error codes. /// /// See [RFC 6749, section 5.2](http://tools.ietf.org/html/rfc6749#section-5.2). -#[derive(Debug, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub enum OAuth2ErrorCode { /// The request is missing a required parameter, includes an unsupported parameter value (other /// than grant type), repeats a parameter, includes multiple credentials, utilizes more than @@ -57,7 +57,7 @@ impl<'a> From<&'a str> for OAuth2ErrorCode { /// OAuth 2.0 error. /// /// See [RFC 6749, section 5.2](http://tools.ietf.org/html/rfc6749#section-5.2). -#[derive(Debug, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct OAuth2Error { /// Error code. pub code: OAuth2ErrorCode, diff --git a/src/lib.rs b/src/lib.rs index 67a80ca..ffad986 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -126,6 +126,7 @@ #![warn( missing_docs, missing_debug_implementations, + missing_copy_implementations, trivial_casts, trivial_numeric_casts, unused_extern_crates, diff --git a/src/provider.rs b/src/provider.rs index ca86a57..4c60d5d 100644 --- a/src/provider.rs +++ b/src/provider.rs @@ -25,7 +25,7 @@ pub trait Provider { /// /// See [Using OAuth 2.0 to Access Google /// APIs](https://developers.google.com/identity/protocols/OAuth2). -#[derive(Debug)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct Google; impl Provider for Google { type Lifetime = Expiring; @@ -37,7 +37,7 @@ impl Provider for Google { /// GitHub OAuth 2.0 provider. /// /// See [OAuth, GitHub Developer Guide](https://developer.github.com/v3/oauth/). -#[derive(Debug)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct GitHub; impl Provider for GitHub { type Lifetime = Static; @@ -49,7 +49,7 @@ impl Provider for GitHub { /// Imgur OAuth 2.0 provider. /// /// See [OAuth 2.0, Imgur](https://api.imgur.com/oauth2). -#[derive(Debug)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct Imgur; impl Provider for Imgur { type Lifetime = Expiring; diff --git a/src/token/bearer.rs b/src/token/bearer.rs index 0ff675d..781162f 100644 --- a/src/token/bearer.rs +++ b/src/token/bearer.rs @@ -7,7 +7,7 @@ use client::response::{FromResponse, ParseError, JsonHelper}; /// The bearer token type. /// /// See [RFC 6750](http://tools.ietf.org/html/rfc6750). -#[derive(Debug, PartialEq, Eq, RustcEncodable, RustcDecodable)] +#[derive(Debug, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable)] pub struct Bearer { access_token: String, scope: Option, diff --git a/src/token/expiring.rs b/src/token/expiring.rs index 647eaf1..0ad8a1c 100644 --- a/src/token/expiring.rs +++ b/src/token/expiring.rs @@ -6,7 +6,7 @@ use super::Lifetime; use client::response::{FromResponse, ParseError, JsonHelper}; /// An expiring token. -#[derive(Debug, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct Expiring { refresh_token: String, expires: DateTime, diff --git a/src/token/statik.rs b/src/token/statik.rs index d9ee569..3180588 100644 --- a/src/token/statik.rs +++ b/src/token/statik.rs @@ -4,7 +4,7 @@ use super::Lifetime; use client::response::{FromResponse, ParseError, JsonHelper}; /// A static, non-expiring token. -#[derive(Debug, PartialEq, Eq, RustcEncodable, RustcDecodable)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable)] pub struct Static; impl Lifetime for Static {