core: define 'TxAmount::ZERO'

This commit is contained in:
Bruno BELANYI 2022-08-23 12:18:12 +02:00
parent ffd6a20a30
commit 963748e1d9

View file

@ -1,5 +1,6 @@
//! Core types used in the processing of payments. //! Core types used in the processing of payments.
use fpdec::{Dec, Decimal};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_with::{serde_as, DisplayFromStr}; use serde_with::{serde_as, DisplayFromStr};
@ -24,4 +25,8 @@ pub struct TxId(pub u32);
#[serde_as] #[serde_as]
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Deserialize, Serialize)] #[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Deserialize, Serialize)]
#[serde(transparent)] #[serde(transparent)]
pub struct TxAmount(#[serde_as(as = "DisplayFromStr")] pub fpdec::Decimal); pub struct TxAmount(#[serde_as(as = "DisplayFromStr")] pub Decimal);
impl TxAmount {
pub const ZERO: Self = Self(Dec!(0));
}