pub struct JournalEntry { /* private fields */ }Expand description
A balanced journal entry.
Implementations§
Source§impl JournalEntry
impl JournalEntry
Sourcepub fn new(
entry_id: impl AsRef<str>,
postings: Vec<Posting>,
) -> Result<Self, LedgerError>
pub fn new( entry_id: impl AsRef<str>, postings: Vec<Posting>, ) -> Result<Self, LedgerError>
Creates a journal entry and validates that debits and credits balance.
§Errors
Returns LedgerError::EmptyEntryId for an empty entry identifier,
LedgerError::NoPostings when no postings are supplied, and
LedgerError::NotBalanced when debits and credits do not balance by currency and scale.
Sourcepub fn is_balanced(&self) -> bool
pub fn is_balanced(&self) -> bool
Returns whether debits and credits balance by currency and amount scale.
Trait Implementations§
Source§impl Clone for JournalEntry
impl Clone for JournalEntry
Source§fn clone(&self) -> JournalEntry
fn clone(&self) -> JournalEntry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for JournalEntry
impl Debug for JournalEntry
impl Eq for JournalEntry
Source§impl<'a> IntoIterator for &'a JournalEntry
impl<'a> IntoIterator for &'a JournalEntry
Source§impl PartialEq for JournalEntry
impl PartialEq for JournalEntry
Source§fn eq(&self, other: &JournalEntry) -> bool
fn eq(&self, other: &JournalEntry) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for JournalEntry
Auto Trait Implementations§
impl Freeze for JournalEntry
impl RefUnwindSafe for JournalEntry
impl Send for JournalEntry
impl Sync for JournalEntry
impl Unpin for JournalEntry
impl UnsafeUnpin for JournalEntry
impl UnwindSafe for JournalEntry
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