pub struct Transaction {
pub date: NaiveDate,
pub flag: char,
pub payee: Option<InternedStr>,
pub narration: InternedStr,
pub tags: Vec<InternedStr>,
pub links: Vec<InternedStr>,
pub meta: Metadata,
pub postings: Vec<Posting>,
}Expand description
A transaction directive.
Transactions are the most common directive type. They record transfers between accounts and must balance (sum of all postings equals zero).
Fields§
§date: NaiveDateTransaction date
flag: charTransaction flag (* or !)
payee: Option<InternedStr>Payee (optional)
narration: InternedStrNarration (description)
Tags attached to this transaction
links: Vec<InternedStr>Links attached to this transaction
meta: MetadataTransaction metadata
postings: Vec<Posting>Postings (account entries)
Implementations§
Source§impl Transaction
impl Transaction
Sourcepub fn new(date: NaiveDate, narration: impl Into<InternedStr>) -> Self
pub fn new(date: NaiveDate, narration: impl Into<InternedStr>) -> Self
Create a new transaction.
Sourcepub fn with_payee(self, payee: impl Into<InternedStr>) -> Self
pub fn with_payee(self, payee: impl Into<InternedStr>) -> Self
Set the payee.
Sourcepub fn with_tag(self, tag: impl Into<InternedStr>) -> Self
pub fn with_tag(self, tag: impl Into<InternedStr>) -> Self
Add a tag.
Sourcepub fn with_link(self, link: impl Into<InternedStr>) -> Self
pub fn with_link(self, link: impl Into<InternedStr>) -> Self
Add a link.
Sourcepub fn with_posting(self, posting: Posting) -> Self
pub fn with_posting(self, posting: Posting) -> Self
Add a posting.
Sourcepub const fn is_complete(&self) -> bool
pub const fn is_complete(&self) -> bool
Check if this transaction is marked as complete (*).
Sourcepub const fn is_incomplete(&self) -> bool
pub const fn is_incomplete(&self) -> bool
Check if this transaction is marked as incomplete/pending (!).
Sourcepub const fn is_pending(&self) -> bool
pub const fn is_pending(&self) -> bool
Check if this transaction is marked as pending (!).
Alias for is_incomplete.
Sourcepub const fn is_pad_generated(&self) -> bool
pub const fn is_pad_generated(&self) -> bool
Check if this transaction was generated by a pad directive (P).
Sourcepub const fn is_summarization(&self) -> bool
pub const fn is_summarization(&self) -> bool
Check if this is a summarization transaction (S).
Sourcepub const fn is_transfer(&self) -> bool
pub const fn is_transfer(&self) -> bool
Check if this is a transfer transaction (T).
Sourcepub const fn is_conversion(&self) -> bool
pub const fn is_conversion(&self) -> bool
Check if this is a currency conversion transaction (C).
Sourcepub const fn is_unrealized(&self) -> bool
pub const fn is_unrealized(&self) -> bool
Check if this is an unrealized gains transaction (U).
Sourcepub const fn is_bookmarked(&self) -> bool
pub const fn is_bookmarked(&self) -> bool
Check if this transaction is bookmarked (#).
Sourcepub const fn needs_investigation(&self) -> bool
pub const fn needs_investigation(&self) -> bool
Check if this transaction needs investigation (?).
Sourcepub const fn is_valid_flag(flag: char) -> bool
pub const fn is_valid_flag(flag: char) -> bool
Check if the given character is a valid transaction flag.
Trait Implementations§
Source§impl Archive for Transaction
impl Archive for Transaction
Source§type Archived = ArchivedTransaction
type Archived = ArchivedTransaction
Source§type Resolver = TransactionResolver
type Resolver = TransactionResolver
Source§fn resolve(&self, resolver: Self::Resolver, out: Place<Self::Archived>)
fn resolve(&self, resolver: Self::Resolver, out: Place<Self::Archived>)
Source§const COPY_OPTIMIZATION: CopyOptimization<Self> = _
const COPY_OPTIMIZATION: CopyOptimization<Self> = _
serialize. Read moreSource§impl Clone for Transaction
impl Clone for Transaction
Source§fn clone(&self) -> Transaction
fn clone(&self) -> Transaction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Transaction
impl Debug for Transaction
Source§impl<'de> Deserialize<'de> for Transaction
impl<'de> Deserialize<'de> for Transaction
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>,
Source§impl<__D: Fallible + ?Sized> Deserialize<Transaction, __D> for Archived<Transaction>where
AsNaiveDate: ArchiveWith<NaiveDate> + DeserializeWith<<AsNaiveDate as ArchiveWith<NaiveDate>>::Archived, NaiveDate, __D>,
char: Archive,
<char as Archive>::Archived: Deserialize<char, __D>,
AsOptionInternedStr: ArchiveWith<Option<InternedStr>> + DeserializeWith<<AsOptionInternedStr as ArchiveWith<Option<InternedStr>>>::Archived, Option<InternedStr>, __D>,
AsInternedStr: ArchiveWith<InternedStr> + DeserializeWith<<AsInternedStr as ArchiveWith<InternedStr>>::Archived, InternedStr, __D>,
AsVecInternedStr: ArchiveWith<Vec<InternedStr>> + DeserializeWith<<AsVecInternedStr as ArchiveWith<Vec<InternedStr>>>::Archived, Vec<InternedStr>, __D>,
Metadata: Archive,
<Metadata as Archive>::Archived: Deserialize<Metadata, __D>,
Vec<Posting>: Archive,
<Vec<Posting> as Archive>::Archived: Deserialize<Vec<Posting>, __D>,
impl<__D: Fallible + ?Sized> Deserialize<Transaction, __D> for Archived<Transaction>where
AsNaiveDate: ArchiveWith<NaiveDate> + DeserializeWith<<AsNaiveDate as ArchiveWith<NaiveDate>>::Archived, NaiveDate, __D>,
char: Archive,
<char as Archive>::Archived: Deserialize<char, __D>,
AsOptionInternedStr: ArchiveWith<Option<InternedStr>> + DeserializeWith<<AsOptionInternedStr as ArchiveWith<Option<InternedStr>>>::Archived, Option<InternedStr>, __D>,
AsInternedStr: ArchiveWith<InternedStr> + DeserializeWith<<AsInternedStr as ArchiveWith<InternedStr>>::Archived, InternedStr, __D>,
AsVecInternedStr: ArchiveWith<Vec<InternedStr>> + DeserializeWith<<AsVecInternedStr as ArchiveWith<Vec<InternedStr>>>::Archived, Vec<InternedStr>, __D>,
Metadata: Archive,
<Metadata as Archive>::Archived: Deserialize<Metadata, __D>,
Vec<Posting>: Archive,
<Vec<Posting> as Archive>::Archived: Deserialize<Vec<Posting>, __D>,
Source§fn deserialize(
&self,
deserializer: &mut __D,
) -> Result<Transaction, <__D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut __D, ) -> Result<Transaction, <__D as Fallible>::Error>
Source§impl Display for Transaction
impl Display for Transaction
Source§impl PartialEq for Transaction
impl PartialEq for Transaction
Source§impl<__S: Fallible + ?Sized> Serialize<__S> for Transactionwhere
AsNaiveDate: SerializeWith<NaiveDate, __S>,
char: Serialize<__S>,
AsOptionInternedStr: SerializeWith<Option<InternedStr>, __S>,
AsInternedStr: SerializeWith<InternedStr, __S>,
AsVecInternedStr: SerializeWith<Vec<InternedStr>, __S>,
Metadata: Serialize<__S>,
Vec<Posting>: Serialize<__S>,
impl<__S: Fallible + ?Sized> Serialize<__S> for Transactionwhere
AsNaiveDate: SerializeWith<NaiveDate, __S>,
char: Serialize<__S>,
AsOptionInternedStr: SerializeWith<Option<InternedStr>, __S>,
AsInternedStr: SerializeWith<InternedStr, __S>,
AsVecInternedStr: SerializeWith<Vec<InternedStr>, __S>,
Metadata: Serialize<__S>,
Vec<Posting>: Serialize<__S>,
Source§impl Serialize for Transaction
impl Serialize for Transaction
impl Eq for Transaction
impl StructuralPartialEq for Transaction
Auto Trait Implementations§
impl Freeze for Transaction
impl RefUnwindSafe for Transaction
impl Send for Transaction
impl Sync for Transaction
impl Unpin for Transaction
impl UnwindSafe for Transaction
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> ArchiveUnsized for Twhere
T: Archive,
impl<T> ArchiveUnsized for Twhere
T: Archive,
Source§type Archived = <T as Archive>::Archived
type Archived = <T as Archive>::Archived
Archive, it may be
unsized. Read moreSource§fn archived_metadata(
&self,
) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
fn archived_metadata( &self, ) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.