Skip to main content

book

Function book 

Source
pub fn book(directives: &[Directive], method: BookingMethod) -> LedgerBookResult
Expand description

Book and interpolate every transaction in a ledger in one shot.

This is the standalone equivalent of the loader’s internal booking pass. Transactions are processed in booking order — sorted by (date, priority, has_cost_reduction) — so lot matching and capital-gains tracking observe inventory in the correct sequence, while the returned LedgerBookResult::booked / LedgerBookResult::failed vectors preserve the caller’s original input order. Non-transaction directives pass through untouched. Per-account booking methods declared via Open ... "METHOD" are honored; method is the fallback for accounts that declare none.

Booking is a pure function of its inputs, so calling it twice on the same (directives, method) yields equal results — this is the booking half of the #1235 pipeline-boundary invariants.