Skip to content

Commit

Permalink
feat(num): ✨ Amount is From<u8> and From<u16>
Browse files Browse the repository at this point in the history
  • Loading branch information
cratelyn committed Mar 15, 2024
1 parent 6268a27 commit a9263c4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions crates/core/num/src/amount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,22 @@ impl From<u32> for Amount {
}
}

impl From<u16> for Amount {
fn from(amount: u16) -> Amount {
Amount {
inner: amount as u128,
}
}
}

impl From<u8> for Amount {
fn from(amount: u8) -> Amount {
Amount {
inner: amount as u128,
}
}
}

impl From<Amount> for f64 {
fn from(amount: Amount) -> f64 {
amount.inner as f64
Expand Down

0 comments on commit a9263c4

Please sign in to comment.