pub struct Transaction<PostingType> {
pub status: TransactionStatus,
pub date: Option<NaiveDate>,
pub effective_date: Option<NaiveDate>,
pub cleared: Cleared,
pub code: Option<String>,
pub description: String,
pub payee: Option<String>,
pub postings: RefCell<Vec<PostingType>>,
pub comments: Vec<Comment>,
pub transaction_type: TransactionType,
pub tags: Vec<Tag>,
/* private fields */
}Fields§
§status: TransactionStatus§date: Option<NaiveDate>§effective_date: Option<NaiveDate>§cleared: Cleared§code: Option<String>§description: String§payee: Option<String>§postings: RefCell<Vec<PostingType>>§comments: Vec<Comment>§transaction_type: TransactionTypeImplementations§
Source§impl<T> Transaction<T>
impl<T> Transaction<T>
Source§impl<PostingType> Transaction<PostingType>
impl<PostingType> Transaction<PostingType>
pub fn new(t_type: TransactionType) -> Transaction<PostingType>
Source§impl Transaction<Posting>
impl Transaction<Posting>
pub fn is_balanced(&self) -> bool
pub fn num_empty_postings(&self) -> usize
Sourcepub fn balance(
&mut self,
balances: &mut HashMap<Rc<Account>, Balance>,
skip_balance_check: bool,
) -> Result<Balance, Box<dyn Error>>
pub fn balance( &mut self, balances: &mut HashMap<Rc<Account>, Balance>, skip_balance_check: bool, ) -> Result<Balance, Box<dyn Error>>
Balances the transaction There are two groups of postings that have to balance:
- the real postings
- the virtual postings that must balance, but not the virtual postings Real postings can have things like cost or balance assertions. However virtual postings can’t.
Because balance assertions depend on previous transactions, this function receives a balances Hashmap as a parameter. If the skip_balance_check flag is set to true, balance assertions are skipped.
Trait Implementations§
Source§impl<PostingType: Clone> Clone for Transaction<PostingType>
impl<PostingType: Clone> Clone for Transaction<PostingType>
Source§fn clone(&self) -> Transaction<PostingType>
fn clone(&self) -> Transaction<PostingType>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<PostingType: Debug> Debug for Transaction<PostingType>
impl<PostingType: Debug> Debug for Transaction<PostingType>
Auto Trait Implementations§
impl<PostingType> !Freeze for Transaction<PostingType>
impl<PostingType> !RefUnwindSafe for Transaction<PostingType>
impl<PostingType> Send for Transaction<PostingType>where
PostingType: Send,
impl<PostingType> !Sync for Transaction<PostingType>
impl<PostingType> Unpin for Transaction<PostingType>where
PostingType: Unpin,
impl<PostingType> UnwindSafe for Transaction<PostingType>where
PostingType: UnwindSafe,
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