Skip to content

Commit

Permalink
feat: adding a Token::is_zero API
Browse files Browse the repository at this point in the history
  • Loading branch information
bochaco committed Jun 30, 2023
1 parent 9f6ac04 commit 9885b56
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/fee_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl FeeOutput {
}

pub fn is_free(&self) -> bool {
self.token == Token::zero()
self.token.is_zero()
}

pub fn to_bytes(&self) -> Vec<u8> {
Expand Down
5 changes: 5 additions & 0 deletions src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ impl Token {
Self(0)
}

/// Returns whether it's a representation of zero Token.
pub const fn is_zero(&self) -> bool {
self.0 == 0
}

/// New value from a number of nano tokens.
pub const fn from_nano(value: u64) -> Self {
Self(value)
Expand Down

0 comments on commit 9885b56

Please sign in to comment.