BudgetDialogState

Struct BudgetDialogState 

Source
pub struct BudgetDialogState {
Show 17 fields pub category_id: Option<CategoryId>, pub category_name: String, pub active_tab: BudgetTab, pub error_message: Option<String>, pub current_budgeted: Money, pub suggested_amount: Option<Money>, pub period_amount_input: String, pub period_cursor: usize, pub has_existing_target: bool, pub target_amount_input: String, pub target_amount_cursor: usize, pub cadence: CadenceOption, pub custom_days_input: String, pub custom_days_cursor: usize, pub target_date_input: String, pub target_date_cursor: usize, pub target_field: TargetField,
}
Expand description

State for the unified budget dialog

Fields§

§category_id: Option<CategoryId>§category_name: String§active_tab: BudgetTab§error_message: Option<String>§current_budgeted: Money§suggested_amount: Option<Money>§period_amount_input: String§period_cursor: usize§has_existing_target: bool§target_amount_input: String§target_amount_cursor: usize§cadence: CadenceOption§custom_days_input: String§custom_days_cursor: usize§target_date_input: String§target_date_cursor: usize§target_field: TargetField

Implementations§

Source§

impl BudgetDialogState

Source

pub fn new() -> Self

Source

pub fn init_for_category( &mut self, category_id: CategoryId, category_name: String, current_budgeted: Money, suggested_amount: Option<Money>, existing_target: Option<&BudgetTarget>, )

Initialize the dialog for a category

Source

pub fn reset(&mut self)

Reset the state

Source

pub fn toggle_tab(&mut self)

Switch to the other tab

Source

pub fn use_suggested(&mut self)

Fill in the suggested amount (period tab)

Source

pub fn period_insert_char(&mut self, c: char)

Source

pub fn period_backspace(&mut self)

Source

pub fn period_move_left(&mut self)

Source

pub fn period_move_right(&mut self)

Source

pub fn period_clear(&mut self)

Source

pub fn parse_period_amount(&self) -> Result<Money, String>

Source

pub fn target_next_field(&mut self)

Source

pub fn target_prev_field(&mut self)

Source

pub fn next_cadence(&mut self)

Source

pub fn prev_cadence(&mut self)

Source

pub fn target_insert_char(&mut self, c: char)

Source

pub fn target_backspace(&mut self)

Source

pub fn target_move_left(&mut self)

Source

pub fn target_move_right(&mut self)

Source

pub fn target_clear_field(&mut self)

Source

pub fn parse_target_amount(&self) -> Result<Money, String>

Source

pub fn parse_custom_days(&self) -> Result<u32, String>

Source

pub fn parse_target_date(&self) -> Result<NaiveDate, String>

Source

pub fn build_cadence(&self) -> Result<TargetCadence, String>

Source

pub fn set_error(&mut self, msg: impl Into<String>)

Trait Implementations§

Source§

impl Clone for BudgetDialogState

Source§

fn clone(&self) -> BudgetDialogState

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BudgetDialogState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BudgetDialogState

Source§

fn default() -> BudgetDialogState

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.