Enum beancount_parser::Directive
source · #[non_exhaustive]
pub enum Directive<'a> {
Transaction(Transaction<'a>),
Price(Price<'a>),
Open(Open<'a>),
Close(Close<'a>),
}Expand description
A directive
A beancount file is made of directives.
By far the the most common directive is the Transaction.
Variants (Non-exhaustive)
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Transaction(Transaction<'a>)
The Transaction directive
Price(Price<'a>)
The Price directive
Open(Open<'a>)
The Open account directive
Close(Close<'a>)
The Close account directive
Implementations
sourceimpl<'a> Directive<'a>
impl<'a> Directive<'a>
sourcepub fn as_transaction(&self) -> Option<&Transaction<'a>>
pub fn as_transaction(&self) -> Option<&Transaction<'a>>
Returns the Transaction reference if this directive is a transaction
See also Directive::into_transaction
sourcepub fn into_transaction(self) -> Option<Transaction<'a>>
pub fn into_transaction(self) -> Option<Transaction<'a>>
Convert into a Transaction if this directive is a transaction
See also Directive::as_transaction
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for Directive<'a>
impl<'a> Send for Directive<'a>
impl<'a> Sync for Directive<'a>
impl<'a> Unpin for Directive<'a>
impl<'a> UnwindSafe for Directive<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more