Skip to content

Commit

Permalink
Implement Clone for TokenData<T> if T: Clone (#298)
Browse files Browse the repository at this point in the history
If T: Clone, we can write a Clone implementation for `TokenData`.
  • Loading branch information
fiadliel committed Mar 15, 2023
1 parent 147d241 commit f517b9a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/decoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ pub struct TokenData<T> {
pub claims: T,
}

impl<T> Clone for TokenData<T>
where
T: Clone,
{
fn clone(&self) -> Self {
Self { header: self.header.clone(), claims: self.claims.clone() }
}
}

/// Takes the result of a rsplit and ensure we only get 2 parts
/// Errors if we don't
macro_rules! expect_two {
Expand Down

0 comments on commit f517b9a

Please sign in to comment.