pub struct Ledger<'ctx> { /* private fields */ }
Expand description
Contains processed transactions, so that users can query information.
Implementations§
Source§impl<'ctx> Ledger<'ctx>
impl<'ctx> Ledger<'ctx>
Sourcepub fn transactions(&self) -> impl Iterator<Item = &Transaction<'ctx>>
pub fn transactions(&self) -> impl Iterator<Item = &Transaction<'ctx>>
Returns iterator for all transactions.
Sourcepub fn postings<'a>(
&'a self,
ctx: &ReportContext<'ctx>,
query: &PostingQuery,
) -> Vec<&'a Posting<'ctx>>
pub fn postings<'a>( &'a self, ctx: &ReportContext<'ctx>, query: &PostingQuery, ) -> Vec<&'a Posting<'ctx>>
Returns all postings following the queries.
Sourcepub fn balance(
&mut self,
ctx: &ReportContext<'ctx>,
query: &BalanceQuery<'ctx>,
) -> Result<Cow<'_, Balance<'ctx>>, QueryError>
pub fn balance( &mut self, ctx: &ReportContext<'ctx>, query: &BalanceQuery<'ctx>, ) -> Result<Cow<'_, Balance<'ctx>>, QueryError>
Returns a balance matching the given query. Note that currently we don’t have the query, that will be added soon.
Sourcepub fn eval(
&mut self,
ctx: &ReportContext<'ctx>,
expression: &str,
eval_ctx: &EvalContext,
) -> Result<Amount<'ctx>, QueryError>
pub fn eval( &mut self, ctx: &ReportContext<'ctx>, expression: &str, eval_ctx: &EvalContext, ) -> Result<Amount<'ctx>, QueryError>
Evals given expression
with the given condition.
Trait Implementations§
Auto Trait Implementations§
impl<'ctx> Freeze for Ledger<'ctx>
impl<'ctx> RefUnwindSafe for Ledger<'ctx>
impl<'ctx> Send for Ledger<'ctx>
impl<'ctx> Sync for Ledger<'ctx>
impl<'ctx> Unpin for Ledger<'ctx>
impl<'ctx> !UnwindSafe for Ledger<'ctx>
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