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: TargetFieldImplementations§
Source§impl BudgetDialogState
impl BudgetDialogState
pub fn new() -> Self
Sourcepub fn init_for_category(
&mut self,
category_id: CategoryId,
category_name: String,
current_budgeted: Money,
suggested_amount: Option<Money>,
existing_target: Option<&BudgetTarget>,
)
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
Sourcepub fn toggle_tab(&mut self)
pub fn toggle_tab(&mut self)
Switch to the other tab
Sourcepub fn use_suggested(&mut self)
pub fn use_suggested(&mut self)
Fill in the suggested amount (period tab)
pub fn period_insert_char(&mut self, c: char)
pub fn period_backspace(&mut self)
pub fn period_move_left(&mut self)
pub fn period_move_right(&mut self)
pub fn period_clear(&mut self)
pub fn parse_period_amount(&self) -> Result<Money, String>
pub fn target_next_field(&mut self)
pub fn target_prev_field(&mut self)
pub fn next_cadence(&mut self)
pub fn prev_cadence(&mut self)
pub fn target_insert_char(&mut self, c: char)
pub fn target_backspace(&mut self)
pub fn target_move_left(&mut self)
pub fn target_move_right(&mut self)
pub fn target_clear_field(&mut self)
pub fn parse_target_amount(&self) -> Result<Money, String>
pub fn parse_custom_days(&self) -> Result<u32, String>
pub fn parse_target_date(&self) -> Result<NaiveDate, String>
pub fn build_cadence(&self) -> Result<TargetCadence, String>
pub fn set_error(&mut self, msg: impl Into<String>)
Trait Implementations§
Source§impl Clone for BudgetDialogState
impl Clone for BudgetDialogState
Source§fn clone(&self) -> BudgetDialogState
fn clone(&self) -> BudgetDialogState
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 BudgetDialogState
impl Debug for BudgetDialogState
Source§impl Default for BudgetDialogState
impl Default for BudgetDialogState
Source§fn default() -> BudgetDialogState
fn default() -> BudgetDialogState
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for BudgetDialogState
impl RefUnwindSafe for BudgetDialogState
impl Send for BudgetDialogState
impl Sync for BudgetDialogState
impl Unpin for BudgetDialogState
impl UnwindSafe for BudgetDialogState
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,
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