pub struct Transaction(/* private fields */);Expand description
DATE FLAG ["PAYEE"] "NARRATION" #TAG... ^LINK...
followed by indented POSTING lines and META_ENTRY
sub-lines.
Implementations§
Source§impl Transaction
impl Transaction
pub fn date(&self) -> Option<Date>
Sourcepub fn flag(&self) -> Option<TransactionFlag>
pub fn flag(&self) -> Option<TransactionFlag>
Transaction flag token. May be STAR (*), PENDING_KW
(!), FLAG letter, HASH (#), TXN_KW
(the txn keyword), single-char CURRENCY (ticker-letter
flag), or absent (implied via a leading STRING
payee/narration).
Scoped to the flag-position region (between DATE and the
first STRING/TAG/LINK) so a stray trailing
single-char CURRENCY after the narration is NOT
misclassified as a flag.
Sourcepub fn strings(&self) -> impl Iterator<Item = StringLit> + '_
pub fn strings(&self) -> impl Iterator<Item = StringLit> + '_
All STRING tokens in the header, in source order.
Scoped to the header (tokens before the terminating
NEWLINE), so STRING tokens emitted into TRANSACTION by
emit_transaction_body’s catch-all for malformed indented
body lines are excluded.
The 2-string convention ("payee" "narration") is the
canonical form; Self::payee and Self::narration
follow it strictly. For 3+ strings (malformed but
losslessly parsed), use this method to surface every
header string.
Sourcepub fn payee(&self) -> Option<StringLit>
pub fn payee(&self) -> Option<StringLit>
The payee string, if a separate payee + narration pair is
present. Returns Some(first) ONLY when exactly two
header STRING tokens appear (the canonical
"payee" "narration" shape). With 0, 1, or 3+ strings
the convention is ambiguous and this returns None —
use Self::strings for lossless access.
Sourcepub fn narration(&self) -> Option<StringLit>
pub fn narration(&self) -> Option<StringLit>
The narration string. Returns Some(only) for a single
header string and Some(last) for the 2-string
"payee" "narration" form. Returns None for 0 or 3+
strings — use Self::strings for lossless access on
malformed headers.
All #TAG tokens attached to the transaction header.
Scoped to the header region (excludes body tokens).
Sourcepub fn links(&self) -> impl Iterator<Item = Link> + '_
pub fn links(&self) -> impl Iterator<Item = Link> + '_
All ^LINK tokens attached to the transaction header.
Scoped to the header region (excludes body tokens).
Sourcepub fn postings(&self) -> impl Iterator<Item = Posting> + '_
pub fn postings(&self) -> impl Iterator<Item = Posting> + '_
All POSTING sub-lines, in source order.
Sourcepub fn meta_entries(&self) -> impl Iterator<Item = MetaEntry> + '_
pub fn meta_entries(&self) -> impl Iterator<Item = MetaEntry> + '_
Transaction-level META_ENTRY sub-lines — those not attached
to a posting (chiefly metadata preceding the first posting).
Trait Implementations§
Source§impl AstNode for Transaction
impl AstNode for Transaction
Source§fn can_cast(kind: SyntaxKind) -> bool
fn can_cast(kind: SyntaxKind) -> bool
kind is the wrapper’s expected node
kind. Used by cast and by enum dispatch.Source§fn cast(syntax: SyntaxNode) -> Option<Self>
fn cast(syntax: SyntaxNode) -> Option<Self>
syntax if its kind matches; otherwise None.Source§fn syntax(&self) -> &SyntaxNode
fn syntax(&self) -> &SyntaxNode
text() reproduces the original
bytes; children() / children_with_tokens() walk the
tree.Source§impl Clone for Transaction
impl Clone for Transaction
Source§fn clone(&self) -> Transaction
fn clone(&self) -> Transaction
1.0.0 (const: unstable) · 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
impl Eq for Transaction
Source§impl Hash for Transaction
impl Hash for Transaction
Source§impl PartialEq for Transaction
impl PartialEq for Transaction
Source§fn eq(&self, other: &Transaction) -> bool
fn eq(&self, other: &Transaction) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for Transaction
Auto Trait Implementations§
impl !RefUnwindSafe for Transaction
impl !Send for Transaction
impl !Sync for Transaction
impl !UnwindSafe for Transaction
impl Freeze for Transaction
impl Unpin for Transaction
impl UnsafeUnpin 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> 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<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.