pub struct IncomeFormState {
pub period: Option<BudgetPeriod>,
pub focused_field: IncomeField,
pub amount_input: String,
pub amount_cursor: usize,
pub notes_input: String,
pub notes_cursor: usize,
pub has_existing: bool,
pub current_amount: Option<Money>,
pub error_message: Option<String>,
}Expand description
State for the income dialog
Fields§
§period: Option<BudgetPeriod>The period being edited
focused_field: IncomeFieldWhich field is focused
amount_input: StringAmount input
amount_cursor: usizeAmount cursor position
notes_input: StringNotes input
notes_cursor: usizeNotes cursor position
has_existing: boolWhether there’s an existing income expectation
current_amount: Option<Money>Current expected income (for display)
error_message: Option<String>Error message
Implementations§
Source§impl IncomeFormState
impl IncomeFormState
pub fn new() -> Self
Sourcepub fn init_for_period(&mut self, period: &BudgetPeriod, storage: &Storage)
pub fn init_for_period(&mut self, period: &BudgetPeriod, storage: &Storage)
Initialize the dialog for a period
Sourcepub fn set_focus(&mut self, field: IncomeField)
pub fn set_focus(&mut self, field: IncomeField)
Set focus to a field
Sourcepub fn next_field(&mut self)
pub fn next_field(&mut self)
Move to next field
Sourcepub fn prev_field(&mut self)
pub fn prev_field(&mut self)
Move to previous field
Sourcepub fn insert_char(&mut self, c: char)
pub fn insert_char(&mut self, c: char)
Insert character into current field
Sourcepub fn move_right(&mut self)
pub fn move_right(&mut self)
Move cursor right
Sourcepub fn clear_field(&mut self)
pub fn clear_field(&mut self)
Clear current field
Sourcepub fn parse_amount(&self) -> Result<Money, String>
pub fn parse_amount(&self) -> Result<Money, String>
Parse the amount input
Trait Implementations§
Source§impl Clone for IncomeFormState
impl Clone for IncomeFormState
Source§fn clone(&self) -> IncomeFormState
fn clone(&self) -> IncomeFormState
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 IncomeFormState
impl Debug for IncomeFormState
Source§impl Default for IncomeFormState
impl Default for IncomeFormState
Source§fn default() -> IncomeFormState
fn default() -> IncomeFormState
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for IncomeFormState
impl RefUnwindSafe for IncomeFormState
impl Send for IncomeFormState
impl Sync for IncomeFormState
impl Unpin for IncomeFormState
impl UnwindSafe for IncomeFormState
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