Skip to content

Commit f517b9a

Browse files
authored
Implement Clone for TokenData<T> if T: Clone (#298)
If T: Clone, we can write a Clone implementation for `TokenData`.
1 parent 147d241 commit f517b9a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/decoding.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ pub struct TokenData<T> {
2020
pub claims: T,
2121
}
2222

23+
impl<T> Clone for TokenData<T>
24+
where
25+
T: Clone,
26+
{
27+
fn clone(&self) -> Self {
28+
Self { header: self.header.clone(), claims: self.claims.clone() }
29+
}
30+
}
31+
2332
/// Takes the result of a rsplit and ensure we only get 2 parts
2433
/// Errors if we don't
2534
macro_rules! expect_two {

0 commit comments

Comments
 (0)