Skip to content

Commit

Permalink
Add basic arithmetic to Amount type
Browse files Browse the repository at this point in the history
  • Loading branch information
elsirion authored and cdecker committed Sep 26, 2022
1 parent 09dfe39 commit 6abcb18
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions cln-rpc/src/primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,26 @@ impl Amount {
}
}

impl std::ops::Add for Amount {
type Output = Amount;

fn add(self, rhs: Self) -> Self::Output {
Amount {
msat: self.msat + rhs.msat
}
}
}

impl std::ops::Sub for Amount {
type Output = Amount;

fn sub(self, rhs: Self) -> Self::Output {
Amount {
msat: self.msat - rhs.msat
}
}
}

#[derive(Clone, Copy, Debug)]
pub struct ShortChannelId(u64);

Expand Down

0 comments on commit 6abcb18

Please sign in to comment.