Double-entry accounting: accounts, journal entries, and transactions
| Tier | domain |
| Role | unclassified (baselined) |
| Path | crates/domain/ledger |
| Edition | 2021 |
| Targets | domain_ledger |
| Public items | 107 across 1 module |
| Tests | 73 |
What it is for
Double-entry accounting library crates for financial transaction tracking.
This crate provides:
Account- Chart of accounts with hierarchical structureJournalEntry- Groups related transactions (ensures debits = credits)LineItem- Individual debit/credit entriesAccountType- Asset, Liability, Equity, Income, ExpenseEntryStatus- Draft, Posted, Voided
Posting Utilities
The posting module provides helpers for common accounting transactions:
posting::InvoicePostingData- Post invoices (DR A/R, CR Revenue, CR Tax)posting::PaymentPostingData- Post payments (DR Cash, CR A/R)posting::ExpensePostingData- Post expenses (DR Expense, CR Cash/A/P)posting::PostingBuilder- Build custom multi-line entriesposting::create_reversal- Create reversing entries for voids
Capabilities
crate root
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
fn calculate_balance(account_type : AccountType, line_items : & LineItem) -> Decimal |
fn validate_accounting_equation(assets : Decimal, liabilities : Decimal, equity : Decimal, income : Decimal, expenses : Decimal,) -> bool |
Account:Account
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
pub struct Account |
Account:activate
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
Account :: fn activate(& mut self) |
Account:created
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
Account :: fn created_at(& self) -> chrono::DateTime <Utc> |
Account:deactivate
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
Account :: fn deactivate(& mut self) |
Account:deleted
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
Account :: fn deleted_at(& self) -> Option <chrono::DateTime <Utc>> |
Account:id
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
Account :: fn id(& self) -> Uuid |
Account:is
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
Account :: fn is_debit_normal(& self) -> bool |
Account :: fn is_credit_normal(& self) -> bool |
Account:new
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
Account :: fn new(code : impl Into <String>, name : impl Into <String>, account_type : AccountType,) -> Self |
Account:normal
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
Account :: fn normal_balance(& self) -> BalanceType |
Account:restore
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
Account :: fn restore(& mut self) |
Account:soft
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
Account :: fn soft_delete(& mut self) |
Account:touch
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
Account :: fn touch(& mut self) |
Account:updated
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
Account :: fn updated_at(& self) -> chrono::DateTime <Utc> |
Account:with
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
Account :: fn with_parent(mut self, parent_id : Uuid) -> Self |
Account :: fn with_description(mut self, description : impl Into <String>) -> Self |
Account :: fn with_currency(mut self, currency : impl Into <String>) -> Self |
Account :: fn with_subtype(mut self, subtype : AccountSubtype) -> Self |
AccountSubtype
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
pub enum AccountSubtype |
AccountSubtype :: fn account_type(& self) -> AccountType |
AccountSubtype :: fn is_reconcilable(& self) -> bool |
AccountSubtype :: fn all() -> & 'static AccountSubtype |
AccountSubtype :: fn parse_for(account_type : AccountType, s : & str) -> std::result::Result <Self, String> |
AccountSubtype :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result |
AccountSubtype :: fn from_str(s : & str) -> std::result::Result <Self, Self::Err> |
AccountType
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
pub enum AccountType |
AccountType :: fn normal_balance(& self) -> BalanceType |
AccountType :: fn is_debit_normal(& self) -> bool |
AccountType :: fn is_credit_normal(& self) -> bool |
AccountType :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result |
AccountType :: fn from_str(s : & str) -> std::result::Result <Self, Self::Err> |
BalanceType
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
pub enum BalanceType |
BalanceType :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result |
EntryDirection
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
pub enum EntryDirection |
EntryDirection :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result |
EntryDirection :: fn from_str(s : & str) -> std::result::Result <Self, Self::Err> |
EntryStatus
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
pub enum EntryStatus |
EntryStatus :: fn is_editable(& self) -> bool |
EntryStatus :: fn affects_balances(& self) -> bool |
EntryStatus :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result |
EntryStatus :: fn from_str(s : & str) -> std::result::Result <Self, Self::Err> |
JournalEntry:JournalEntry
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
pub struct JournalEntry |
JournalEntry:add
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
JournalEntry :: fn add_debit(& mut self, account_id : Uuid, amount : Money) -> Result <()> |
JournalEntry :: fn add_debit_with_description(& mut self, account_id : Uuid, amount : Money, description : impl Into <String>,) -> Result <()> |
JournalEntry :: fn add_credit(& mut self, account_id : Uuid, amount : Money) -> Result <()> |
JournalEntry :: fn add_credit_with_description(& mut self, account_id : Uuid, amount : Money, description : impl Into <String>,) -> Result <()> |
JournalEntry:created
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
JournalEntry :: fn created_at(& self) -> chrono::DateTime <Utc> |
JournalEntry:credits
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
JournalEntry :: fn credits(& self) -> Vec <& LineItem> |
JournalEntry:debits
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
JournalEntry :: fn debits(& self) -> Vec <& LineItem> |
JournalEntry:id
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
JournalEntry :: fn id(& self) -> Uuid |
JournalEntry:imbalance
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
JournalEntry :: fn imbalance(& self) -> Decimal |
JournalEntry:is
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
JournalEntry :: fn is_balanced(& self) -> bool |
JournalEntry:line
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
JournalEntry :: fn line_count(& self) -> usize |
JournalEntry:new
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
JournalEntry :: fn new(date : NaiveDate, description : impl Into <String>) -> Self |
JournalEntry:post
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
JournalEntry :: fn post(& mut self) -> Result <()> |
JournalEntry:total
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
JournalEntry :: fn total_debits(& self) -> Decimal |
JournalEntry :: fn total_credits(& self) -> Decimal |
JournalEntry:updated
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
JournalEntry :: fn updated_at(& self) -> chrono::DateTime <Utc> |
JournalEntry:void
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
JournalEntry :: fn void(& mut self) -> Result <()> |
JournalEntry:with
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
JournalEntry :: fn with_reference(mut self, reference : impl Into <String>) -> Self |
JournalKind
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
pub enum JournalKind |
JournalKind :: fn all() -> & 'static JournalKind |
JournalKind :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result |
JournalKind :: fn from_str(s : & str) -> std::result::Result <Self, Self::Err> |
LedgerError
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
pub enum LedgerError |
LineItem
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
pub struct LineItem |
LineItem :: fn new(journal_entry_id : Uuid, account_id : Uuid, amount : Money, direction : EntryDirection,) -> Self |
LineItem :: fn with_description(mut self, description : impl Into <String>) -> Self |
LineItem :: fn with_sequence(mut self, sequence : i32) -> Self |
LineItem :: fn is_debit(& self) -> bool |
LineItem :: fn is_credit(& self) -> bool |
LineItem :: fn id(& self) -> Uuid |
Result
Double-entry accounting library crates for financial transaction tracking.
| Item |
|---|
pub type Result<T>: std::result::Result <T, LedgerError> |
posting (other)
Posting utilities for common accounting transactions.
| Item |
|---|
fn create_reversal(original : & JournalEntry, reversal_date : NaiveDate) -> Result <JournalEntry> |
AccountConfig
Posting utilities for common accounting transactions.
| Item |
|---|
pub struct AccountConfig |
AccountConfig :: fn get_cash_account(& self, payment_type : PaymentType) -> Uuid |
ExpensePostingData
Posting utilities for common accounting transactions.
| Item |
|---|
pub struct ExpensePostingData |
ExpensePostingData :: fn new(expense_date : NaiveDate, description : impl Into <String>, amount : Money, expense_account_id : Uuid, payment_account_id : Uuid,) -> Self |
ExpensePostingData :: fn with_vendor(mut self, vendor_id : Uuid) -> Self |
ExpensePostingData :: fn with_reference(mut self, reference : impl Into <String>) -> Self |
ExpensePostingData :: fn create_entry(& self) -> Result <JournalEntry> |
InvoicePostingData
Posting utilities for common accounting transactions.
| Item |
|---|
pub struct InvoicePostingData |
InvoicePostingData :: fn new(invoice_date : NaiveDate, invoice_number : impl Into <String>, party_id : Uuid, subtotal : Money, tax_amount : Money, ar_account_id : Uuid, revenue_account_id : Uuid,) -> Self |
InvoicePostingData :: fn with_tax_account(mut self, account_id : Uuid) -> Self |
InvoicePostingData :: fn with_reference(mut self, reference : impl Into <String>) -> Self |
InvoicePostingData :: fn create_entry(& self) -> Result <JournalEntry> |
PaymentPostingData
Posting utilities for common accounting transactions.
| Item |
|---|
pub struct PaymentPostingData |
PaymentPostingData :: fn new(payment_date : NaiveDate, payment_number : impl Into <String>, party_id : Uuid, amount : Money, payment_type : PaymentType, cash_account_id : Uuid, ar_account_id : Uuid,) -> Self |
PaymentPostingData :: fn with_reference(mut self, reference : impl Into <String>) -> Self |
PaymentPostingData :: fn with_description(mut self, description : impl Into <String>) -> Self |
PaymentPostingData :: fn create_entry(& self) -> Result <JournalEntry> |
PaymentType
Posting utilities for common accounting transactions.
| Item |
|---|
pub enum PaymentType |
PostingBuilder
Posting utilities for common accounting transactions.
| Item |
|---|
pub struct PostingBuilder |
PostingBuilder :: fn new(date : NaiveDate, description : impl Into <String>) -> Self |
PostingBuilder :: fn with_reference(mut self, reference : impl Into <String>) -> Self |
PostingBuilder :: fn debit(mut self, account_id : Uuid, amount : Money, description : impl Into <String>,) -> Self |
PostingBuilder :: fn credit(mut self, account_id : Uuid, amount : Money, description : impl Into <String>,) -> Self |
PostingBuilder :: fn line(mut self, line : PostingLine) -> Self |
PostingBuilder :: fn total_debits(& self) -> Decimal |
PostingBuilder :: fn total_credits(& self) -> Decimal |
PostingBuilder :: fn is_balanced(& self) -> bool |
PostingBuilder :: fn build(self) -> Result <JournalEntry> |
PostingLine
Posting utilities for common accounting transactions.
| Item |
|---|
pub struct PostingLine |
PostingLine :: fn debit(account_id : Uuid, amount : Money, description : impl Into <String>) -> Self |
PostingLine :: fn credit(account_id : Uuid, amount : Money, description : impl Into <String>) -> Self |
How to use it
No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.
Module structure
domain_ledger
posting
Public surface
`crate root`
| Item | What it is |
|---|---|
pub enum LedgerError | Errors that can occur in ledger operations. |
pub type Result<T>: std::result::Result <T, LedgerError> | Result type for ledger operations. |
pub enum AccountType | Type of account in the chart of accounts. |
AccountType :: fn normal_balance(& self) -> BalanceType | Returns the normal balance type for this account type. |
AccountType :: fn is_debit_normal(& self) -> bool | Returns true if this account type has a normal debit balance. |
AccountType :: fn is_credit_normal(& self) -> bool | Returns true if this account type has a normal credit balance. |
AccountType :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result | — |
AccountType :: fn from_str(s : & str) -> std::result::Result <Self, Self::Err> | — |
pub enum AccountSubtype | Sub-classification of an account, scoped to its AccountType |
AccountSubtype :: fn account_type(& self) -> AccountType | The AccountType this subtype belongs to. |
AccountSubtype :: fn is_reconcilable(& self) -> bool | Whether accounts of this subtype are reconciled against a statement |
AccountSubtype :: fn all() -> & 'static AccountSubtype | All subtype variants, in declaration order |
AccountSubtype :: fn parse_for(account_type : AccountType, s : & str) -> std::result::Result <Self, String> | Parse a subtype string and assert it is valid for account_type |
AccountSubtype :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result | — |
AccountSubtype :: fn from_str(s : & str) -> std::result::Result <Self, Self::Err> | — |
pub enum BalanceType | Balance type (debit or credit). |
BalanceType :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result | — |
pub enum EntryDirection | Direction of a line item (debit or credit). |
EntryDirection :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result | — |
EntryDirection :: fn from_str(s : & str) -> std::result::Result <Self, Self::Err> | — |
pub enum EntryStatus | Status of a journal entry. |
EntryStatus :: fn is_editable(& self) -> bool | Returns true if the entry can be modified. |
EntryStatus :: fn affects_balances(& self) -> bool | Returns true if the entry is included in balance calculations. |
EntryStatus :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result | — |
EntryStatus :: fn from_str(s : & str) -> std::result::Result <Self, Self::Err> | — |
pub enum JournalKind | What KIND of journal entry this is — an advisory label that drives UI seeding and reporting, not the posting path (all kinds are balanced N-line entries posted identically) |
JournalKind :: fn all() -> & 'static JournalKind | All kinds, in declaration order. |
JournalKind :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result | — |
JournalKind :: fn from_str(s : & str) -> std::result::Result <Self, Self::Err> | — |
pub struct Account | An account in the chart of accounts. |
Account :: fn new(code : impl Into <String>, name : impl Into <String>, account_type : AccountType,) -> Self | Creates a new account. |
Account :: fn with_parent(mut self, parent_id : Uuid) -> Self | Sets the parent account. |
Account :: fn with_description(mut self, description : impl Into <String>) -> Self | Sets the description. |
Account :: fn with_currency(mut self, currency : impl Into <String>) -> Self | Sets the currency. |
Account :: fn with_subtype(mut self, subtype : AccountSubtype) -> Self | Sets the account subtype |
Account :: fn normal_balance(& self) -> BalanceType | Returns the normal balance type for this account. |
Account :: fn is_debit_normal(& self) -> bool | Returns true if this account has a normal debit balance. |
Account :: fn is_credit_normal(& self) -> bool | Returns true if this account has a normal credit balance. |
Account :: fn deactivate(& mut self) | Deactivates the account. |
Account :: fn activate(& mut self) | Reactivates the account. |
Account :: fn id(& self) -> Uuid | — |
Account :: fn created_at(& self) -> chrono::DateTime <Utc> | — |
Account :: fn updated_at(& self) -> chrono::DateTime <Utc> | — |
Account :: fn deleted_at(& self) -> Option <chrono::DateTime <Utc>> | — |
Account :: fn touch(& mut self) | Updates the updated_at timestamp. |
Account :: fn soft_delete(& mut self) | Soft deletes the account. |
Account :: fn restore(& mut self) | Restores a soft-deleted account. |
pub struct LineItem | A line item in a journal entry (debit or credit). |
LineItem :: fn new(journal_entry_id : Uuid, account_id : Uuid, amount : Money, direction : EntryDirection,) -> Self | Creates a new line item. |
LineItem :: fn with_description(mut self, description : impl Into <String>) -> Self | Sets the description. |
LineItem :: fn with_sequence(mut self, sequence : i32) -> Self | Sets the sequence number. |
LineItem :: fn is_debit(& self) -> bool | Returns true if this is a debit entry. |
LineItem :: fn is_credit(& self) -> bool | Returns true if this is a credit entry. |
LineItem :: fn id(& self) -> Uuid | — |
pub struct JournalEntry | A journal entry (transaction) that groups related debits and credits. |
JournalEntry :: fn new(date : NaiveDate, description : impl Into <String>) -> Self | Creates a new journal entry. |
JournalEntry :: fn with_reference(mut self, reference : impl Into <String>) -> Self | Sets the reference number. |
JournalEntry :: fn add_debit(& mut self, account_id : Uuid, amount : Money) -> Result <()> | Adds a debit line item |
JournalEntry :: fn add_debit_with_description(& mut self, account_id : Uuid, amount : Money, description : impl Into <String>,) -> Result <()> | Adds a debit line item with description |
JournalEntry :: fn add_credit(& mut self, account_id : Uuid, amount : Money) -> Result <()> | Adds a credit line item |
JournalEntry :: fn add_credit_with_description(& mut self, account_id : Uuid, amount : Money, description : impl Into <String>,) -> Result <()> | Adds a credit line item with description |
JournalEntry :: fn total_debits(& self) -> Decimal | Returns the total of all debit entries. |
JournalEntry :: fn total_credits(& self) -> Decimal | Returns the total of all credit entries. |
JournalEntry :: fn is_balanced(& self) -> bool | Returns true if the entry is balanced (debits = credits). |
JournalEntry :: fn imbalance(& self) -> Decimal | Returns the difference between debits and credits. |
JournalEntry :: fn post(& mut self) -> Result <()> | Posts the entry, making it immutable |
JournalEntry :: fn void(& mut self) -> Result <()> | Voids the entry (for audit trail - doesn't delete) |
JournalEntry :: fn line_count(& self) -> usize | Returns the number of line items. |
JournalEntry :: fn debits(& self) -> Vec <& LineItem> | Returns debit line items. |
JournalEntry :: fn credits(& self) -> Vec <& LineItem> | Returns credit line items. |
JournalEntry :: fn id(& self) -> Uuid | — |
JournalEntry :: fn created_at(& self) -> chrono::DateTime <Utc> | — |
JournalEntry :: fn updated_at(& self) -> chrono::DateTime <Utc> | — |
fn calculate_balance(account_type : AccountType, line_items : & LineItem) -> Decimal | Calculates the balance for an account given its line items |
fn validate_accounting_equation(assets : Decimal, liabilities : Decimal, equity : Decimal, income : Decimal, expenses : Decimal,) -> bool | Validates that the accounting equation holds |
`posting`
| Item | What it is |
|---|---|
pub struct PostingLine | A posting line representing a single debit or credit. |
PostingLine :: fn debit(account_id : Uuid, amount : Money, description : impl Into <String>) -> Self | Creates a debit posting line. |
PostingLine :: fn credit(account_id : Uuid, amount : Money, description : impl Into <String>) -> Self | Creates a credit posting line. |
pub struct InvoicePostingData | Data required to post an invoice to the ledger. |
InvoicePostingData :: fn new(invoice_date : NaiveDate, invoice_number : impl Into <String>, party_id : Uuid, subtotal : Money, tax_amount : Money, ar_account_id : Uuid, revenue_account_id : Uuid,) -> Self | Creates new invoice posting data. |
InvoicePostingData :: fn with_tax_account(mut self, account_id : Uuid) -> Self | Sets the tax account. |
InvoicePostingData :: fn with_reference(mut self, reference : impl Into <String>) -> Self | Sets the reference. |
InvoicePostingData :: fn create_entry(& self) -> Result <JournalEntry> | Creates a journal entry for this invoice |
pub enum PaymentType | Payment method affecting which cash account to use. |
pub struct PaymentPostingData | Data required to post a payment to the ledger. |
PaymentPostingData :: fn new(payment_date : NaiveDate, payment_number : impl Into <String>, party_id : Uuid, amount : Money, payment_type : PaymentType, cash_account_id : Uuid, ar_account_id : Uuid,) -> Self | Creates new payment posting data. |
PaymentPostingData :: fn with_reference(mut self, reference : impl Into <String>) -> Self | Sets the reference. |
PaymentPostingData :: fn with_description(mut self, description : impl Into <String>) -> Self | Sets a custom description. |
PaymentPostingData :: fn create_entry(& self) -> Result <JournalEntry> | Creates a journal entry for this payment |
pub struct ExpensePostingData | Data required to post an expense to the ledger. |
ExpensePostingData :: fn new(expense_date : NaiveDate, description : impl Into <String>, amount : Money, expense_account_id : Uuid, payment_account_id : Uuid,) -> Self | Creates new expense posting data. |
ExpensePostingData :: fn with_vendor(mut self, vendor_id : Uuid) -> Self | Sets the vendor ID. |
ExpensePostingData :: fn with_reference(mut self, reference : impl Into <String>) -> Self | Sets the reference. |
ExpensePostingData :: fn create_entry(& self) -> Result <JournalEntry> | Creates a journal entry for this expense |
fn create_reversal(original : & JournalEntry, reversal_date : NaiveDate) -> Result <JournalEntry> | Creates a reversing journal entry from an existing entry |
pub struct AccountConfig | Account configuration for common posting scenarios. |
AccountConfig :: fn get_cash_account(& self, payment_type : PaymentType) -> Uuid | Returns the appropriate cash/bank account for a payment type. |
pub struct PostingBuilder | Builder for creating multi-line journal entries. |
PostingBuilder :: fn new(date : NaiveDate, description : impl Into <String>) -> Self | Creates a new posting builder. |
PostingBuilder :: fn with_reference(mut self, reference : impl Into <String>) -> Self | Sets the reference. |
PostingBuilder :: fn debit(mut self, account_id : Uuid, amount : Money, description : impl Into <String>,) -> Self | Adds a debit line. |
PostingBuilder :: fn credit(mut self, account_id : Uuid, amount : Money, description : impl Into <String>,) -> Self | Adds a credit line. |
PostingBuilder :: fn line(mut self, line : PostingLine) -> Self | Adds a posting line. |
PostingBuilder :: fn total_debits(& self) -> Decimal | Returns the total debits. |
PostingBuilder :: fn total_credits(& self) -> Decimal | Returns the total credits. |
PostingBuilder :: fn is_balanced(& self) -> bool | Returns true if the posting is balanced. |
PostingBuilder :: fn build(self) -> Result <JournalEntry> | Builds the journal entry |
No pub use re-exports: every item above is declared in this crate.
Boundary
Reaches into foundation.
Shares tier domain with 41 other crates: domain-agreements, domain-ai-report, domain-billing, domain-catalog, domain-classify, domain-comments, domain-competitive-intel, domain-contact, … (41 total).
_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._
Where it sits
| Tier (ontology) | domain |
| Architectural role (taxonomy) | unclassified (baselined) |
| Location | crates/domain/ledger |
| Vocabulary in force (lexicon) | current |
Tier flow. Which tiers this crate's own edges cross.
flowchart LR n_domain["domain"] --> n_foundation["foundation"]
Dependencies
Runtime, in this workspace.
| Crate | Tier | Optional | Only on |
|---|---|---|---|
| `foundation-basemodels` | foundation | no | always |
| `foundation-money` | foundation | no | always |
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
chrono | ^0.4 | serde | no | always |
rust_decimal | ^1 | serde | no | always |
serde | ^1 | derive | no | always |
serde_json | ^1 | — | no | always |
thiserror | ^2 | — | no | always |
uuid | ^1 | v4, v7, serde, js | no | always |
Development, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
rust_decimal_macros | ^1 | — | no | always |
tokio-test | ^0.4 | — | no | always |
Build. None.
Depended on by. 3 workspace crates.
Signal flow — what reaches this crate, and what it reaches.
flowchart LR n_application_ledger["application-ledger"] -->|uses| SELF n_application_ledger_accounts["application-ledger-accounts"] -->|uses| SELF n_application_ledger_entries["application-ledger-entries"] -->|uses| SELF SELF["domain-ledger"] SELF -->|runtime| n_foundation_basemodels["foundation-basemodels"] SELF -->|runtime| n_foundation_money["foundation-money"] classDef self fill:#1f883d,stroke:#1f883d,color:#fff; class SELF self;
Feature flags
No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.
Targets
| Kind | Name | Source |
|---|---|---|
| lib | domain_ledger | `src/lib.rs` |
Error model
| Error type | Named by |
|---|---|
LedgerError | Result |
Operational characteristics
| Property | Evidence |
|---|---|
| async public surface | none detected |
| async runtime | none detected |
| database access | none detected |
| network I/O | none detected |
| unsafe code | none detected |
| environment variables | none detected |
No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.
Configuration
No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.
Related capabilities
3 workspace crates depend on this one: application-ledger, application-ledger-accounts, application-ledger-entries.
Verification
| Kind | Count |
|---|---|
| Unit tests | 73 |
| Integration tests | 0 |
| Examples | 0 |
| Doctests | 0 |
Evidence by module. How often each public module is named by something executable.
| Module | Tests | Examples | Consumers |
|---|---|---|---|
crate root | 13 | 0 | 8 |
posting | 8 | 0 | 0 |
What the tests establish, by name:
test_account_deactivate_activate—src/lib.rstest_account_has_id—src/lib.rstest_account_new—src/lib.rstest_account_normal_balance—src/lib.rstest_account_serialization—src/lib.rstest_account_soft_deletable—src/lib.rstest_account_subtype_all_is_complete_and_consistent—src/lib.rstest_account_subtype_belongs_to_account_type—src/lib.rstest_account_subtype_default_none_and_builder—src/lib.rstest_account_subtype_display_fromstr_roundtrip—src/lib.rstest_account_subtype_parse_for_accepts_matching_type—src/lib.rstest_account_subtype_parse_for_rejects_cross_type—src/lib.rstest_account_subtype_reconcilable_is_bank_and_credit_card_only—src/lib.rstest_account_subtype_serializes_as_snake_case_string—src/lib.rstest_account_type_display—src/lib.rstest_account_type_from_str—src/lib.rstest_account_type_is_credit_normal—src/lib.rstest_account_type_is_debit_normal—src/lib.rstest_account_type_normal_balance—src/lib.rstest_account_with_currency—src/lib.rstest_account_with_description—src/lib.rstest_account_with_parent—src/lib.rstest_calculate_balance_asset—src/lib.rstest_calculate_balance_expense—src/lib.rstest_calculate_balance_income—src/lib.rstest_calculate_balance_liability—src/lib.rstest_cash_sale_transaction—src/lib.rstest_entry_direction_display—src/lib.rstest_entry_direction_from_str—src/lib.rstest_entry_status_affects_balances—src/lib.rs- _… 43 more_
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 88 | 107 |
Public modules with a //! block | 1 | 1 |
pie showData
title Public items with rustdoc
"Documented" : 88
"No rustdoc detected" : 19
Metrics
| Metric | Value |
|---|---|
| Rust source files | 2 |
| Source lines | 2762 |
| Code lines | 2052 |
| Public API items | 107 |
| Public modules | 1 |
| Tests | 73 |
| Examples | 0 |
| Cargo features | 0 |
| Direct runtime dependencies | 8 |
| Workspace reverse dependencies | 3 |
pie showData
title Public API by kind
"enum" : 8
"function" : 3
"method" : 86
"struct" : 9
"type alias" : 1
pie showData
title Rust source composition
"Code" : 2052
"Blank or comment" : 710
Generation
Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.