pub struct LedgerEntry {
pub id: String,
pub description: String,
pub amount_cents: i64,
pub currency: String,
pub category: Option<String>,
pub counterparty: Option<String>,
pub project_id: Option<String>,
pub occurred_at_unix: u32,
pub occurred_at_instant: Option<InstantBridge>,
}Expand description
A single immutable ledger entry. Amount is signed minor units (cents): positive = credit/income, negative = debit/expense. Entries are never mutated; a correction is a new entry, so the id is a stable content anchor for dedup.
Fields§
§id: String§description: String§amount_cents: i64Signed minor units (e.g. cents). Positive = money in, negative = money out.
currency: StringISO 4217 currency code (e.g. “AUD”).
category: Option<String>§counterparty: Option<String>§project_id: Option<String>Optional link to a cooperative project (COP/FIN cross-reference).
occurred_at_unix: u32§occurred_at_instant: Option<InstantBridge>High-resolution instant (T71 bridge). Preferred over occurred_at_unix
when present; the u32 field is kept for backward-compatible deserialization.
Implementations§
Source§impl LedgerEntry
impl LedgerEntry
Sourcepub fn new(
description: impl Into<String>,
amount_cents: i64,
currency: impl Into<String>,
occurred_at_unix: u32,
) -> Self
pub fn new( description: impl Into<String>, amount_cents: i64, currency: impl Into<String>, occurred_at_unix: u32, ) -> Self
Creates a new instance.
Sourcepub fn occurred_at(&self) -> InstantBridge
pub fn occurred_at(&self) -> InstantBridge
Resolve the occurred-at instant, preferring the high-resolution
InstantBridge field when present (T71 bridge).
Trait Implementations§
Source§impl Clone for LedgerEntry
impl Clone for LedgerEntry
Source§impl Debug for LedgerEntry
impl Debug for LedgerEntry
Source§impl<'de> Deserialize<'de> for LedgerEntry
impl<'de> Deserialize<'de> for LedgerEntry
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for LedgerEntry
Source§impl PartialEq for LedgerEntry
impl PartialEq for LedgerEntry
Source§impl Serialize for LedgerEntry
impl Serialize for LedgerEntry
impl StructuralPartialEq for LedgerEntry
Auto Trait Implementations§
impl Freeze for LedgerEntry
impl RefUnwindSafe for LedgerEntry
impl Send for LedgerEntry
impl Sync for LedgerEntry
impl Unpin for LedgerEntry
impl UnsafeUnpin for LedgerEntry
impl UnwindSafe for LedgerEntry
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