Skip to content

Commit

Permalink
Add body getter
Browse files Browse the repository at this point in the history
  • Loading branch information
durch committed Feb 24, 2021
1 parent 40f1d21 commit 4259175
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "smpl_jwt"
version = "0.6.0"
version = "0.6.1"
authors = ["Drazen Urch <github@drazenur.ch>"]
description = "Very simple JWT generation lib."
repository = "https://github.com/durch/rust-jwt"
Expand Down
10 changes: 10 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ pub struct Jwt<T> {
algo: Algorithm,
}

impl <T> Jwt<T> {
pub fn body(&self) -> &T {
&self.body
}

pub fn body_mut(&mut self) -> &mut T {
&mut self.body
}
}

impl<T: serde::ser::Serialize> fmt::Display for Jwt<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Jwt: \n header: {} \n body: {}, \n algorithm: {}",
Expand Down

0 comments on commit 4259175

Please sign in to comment.