pub struct LedgerMeta {
pub creditor: BorderlessId,
pub debitor: BorderlessId,
pub len: u64,
pub balances: HashMap<Currency, i64>,
}Expand description
Meta information about this ledger
Fields§
§creditor: BorderlessIdCreditor side
debitor: BorderlessIdDebitor side
len: u64Length of the ledger
balances: HashMap<Currency, i64>Balances by currency ( values are in 1000 units, so 1€ = 1000 )
Implementations§
Source§impl LedgerMeta
impl LedgerMeta
pub fn new(creditor: BorderlessId, debitor: BorderlessId) -> Self
pub fn into_dto(self) -> LedgerMetaDto
Sourcepub fn reset_balance(&mut self)
pub fn reset_balance(&mut self)
Resets the balances and length - useful when creating a temporary balance from the original LedgerMeta
Sourcepub fn update(&mut self, entry: &LedgerEntry) -> Result<()>
pub fn update(&mut self, entry: &LedgerEntry) -> Result<()>
Updates the ledger meta information with the current entry
Returns an error, if the ledger-entry does not belong to this ledger.
Trait Implementations§
Source§impl Debug for LedgerMeta
impl Debug for LedgerMeta
Source§impl<'de> Deserialize<'de> for LedgerMeta
impl<'de> Deserialize<'de> for LedgerMeta
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for LedgerMeta
impl RefUnwindSafe for LedgerMeta
impl Send for LedgerMeta
impl Sync for LedgerMeta
impl Unpin for LedgerMeta
impl UnsafeUnpin for LedgerMeta
impl UnwindSafe for LedgerMeta
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more