pub struct TransactionDraft {
pub note: Option<String>,
pub date: Option<String>,
pub splits: Vec<DraftSplit>,
pub tags: Vec<DraftTag>,
}Expand description
The accumulated result of rendering a template: everything needed to pre-fill a new-transaction form. All fields are optional/append-only; a template sets what it knows and leaves the rest for the user.
Fields§
§note: Option<String>§date: Option<String>§splits: Vec<DraftSplit>Implementations§
Source§impl TransactionDraft
impl TransactionDraft
pub fn new() -> Self
pub fn set_note(&mut self, note: String)
pub fn set_date(&mut self, date: String)
Sourcepub fn split_count(&self) -> usize
pub fn split_count(&self) -> usize
The number of splits drafted so far — the index the next
add_split will return.
Sourcepub fn add_split(&mut self, split: DraftSplit) -> usize
pub fn add_split(&mut self, split: DraftSplit) -> usize
Appends a split and returns its index — the handle a template passes to
add_split_tag to tag that specific split.
pub fn add_tag(&mut self, tag: DraftTag)
Sourcepub fn add_split_tag(&mut self, index: usize, tag: DraftTag) -> bool
pub fn add_split_tag(&mut self, index: usize, tag: DraftTag) -> bool
Attaches a tag to the split at index. Returns false if the index is
out of range (a template handed a stale/invalid handle).
Trait Implementations§
Source§impl Clone for TransactionDraft
impl Clone for TransactionDraft
Source§fn clone(&self) -> TransactionDraft
fn clone(&self) -> TransactionDraft
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TransactionDraft
impl Debug for TransactionDraft
Source§impl Default for TransactionDraft
impl Default for TransactionDraft
Source§fn default() -> TransactionDraft
fn default() -> TransactionDraft
Returns the “default value” for a type. Read more
Source§impl PartialEq for TransactionDraft
impl PartialEq for TransactionDraft
impl Eq for TransactionDraft
impl StructuralPartialEq for TransactionDraft
Auto Trait Implementations§
impl Freeze for TransactionDraft
impl RefUnwindSafe for TransactionDraft
impl Send for TransactionDraft
impl Sync for TransactionDraft
impl Unpin for TransactionDraft
impl UnsafeUnpin for TransactionDraft
impl UnwindSafe for TransactionDraft
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more