README.md
tktax-monthly
A Rust library for monthly financial transaction aggregation, designed to integrate seamlessly with the tktax ecosystem. This crate provides abstractions for enumerating, aggregating, and displaying monthly transactions, allowing concise transformations of raw data into validated summaries. By leveraging AvgMonthly and MonthlySummary structures, users gain production-ready tools suitable for rigorous accounting and tax-reporting applications.
Overview
-
AvgMonthly<TxCat>:
A structure for representing the average monetary outlay or inflow within a givenTransactionCategory. It encapsulates:ty- TheTransactionType(e.g., credit, debit).category- The domain-specific transaction category.value- The calculated averageMonetaryAmount.
-
MonthlySummary:
A chronological consolidation of transactions starting atstart_date. Each field accumulates tallies (akin to aggregare in Latin) of different transaction types:creditsdebitschecksdepositspoint_of_sale
These monoidal accumulations resemble the ἐμπορική συναλλαγή (commercial transaction) grouping, keeping numeric precision intact via MonetaryAmount.
- CreateMonthlySummary:
A trait that can be implemented by a higher-level data repository to produce a collection ofMonthlySummaryinstances.
Usage Example
use ;
- Add the dependency to your
Cargo.toml:[] = "0.1.0" - Implement
CreateMonthlySummaryin your repository type, ensuring it returns a vector ofMonthlySummaryobjects. - Generate monthly summaries, optionally using
AvgMonthlyfor category-based average calculations.
Features
- Robust Aggregation: Safely accumulates monetary transactions across multiple categories.
- Human-Readable Debugging: The custom
fmt::Debugallows single-line or pretty-printed views. - Typed Categories: Avoids stringly-typed design through domain-centric enumerations.
- Production-Ready: Zero usage of
.unwrap()or.expect(), ensuring stable error handling paths.
For additional documentation and usage details, consult the repository or open an issue for feature requests.