pub struct AccountFormState {
pub focused_field: AccountField,
pub name_input: TextInput,
pub account_type_index: usize,
pub balance_input: TextInput,
pub on_budget: bool,
pub is_edit: bool,
pub editing_account_id: Option<AccountId>,
pub error_message: Option<String>,
}Expand description
State for the account form dialog
Fields§
§focused_field: AccountFieldCurrently focused field
name_input: TextInputName input
account_type_index: usizeSelected account type index
balance_input: TextInputStarting balance input
on_budget: boolWhether account is on budget
is_edit: boolWhether this is an edit (vs new account)
editing_account_id: Option<AccountId>Account ID being edited (if editing)
error_message: Option<String>Error message to display
Implementations§
Source§impl AccountFormState
impl AccountFormState
Sourcepub fn from_account(account: &Account) -> Self
pub fn from_account(account: &Account) -> Self
Create form state pre-populated from an existing account
Sourcepub fn next_field(&mut self)
pub fn next_field(&mut self)
Move to the next field
Sourcepub fn prev_field(&mut self)
pub fn prev_field(&mut self)
Move to the previous field
Sourcepub fn set_focus(&mut self, field: AccountField)
pub fn set_focus(&mut self, field: AccountField)
Set focus to a specific field
Sourcepub fn focused_input(&mut self) -> Option<&mut TextInput>
pub fn focused_input(&mut self) -> Option<&mut TextInput>
Get the currently focused text input (if applicable)
Sourcepub fn selected_account_type(&self) -> AccountType
pub fn selected_account_type(&self) -> AccountType
Get selected account type
Sourcepub fn next_account_type(&mut self)
pub fn next_account_type(&mut self)
Move to next account type
Sourcepub fn prev_account_type(&mut self)
pub fn prev_account_type(&mut self)
Move to previous account type
Sourcepub fn toggle_on_budget(&mut self)
pub fn toggle_on_budget(&mut self)
Toggle on-budget status
Sourcepub fn build_account(&self) -> Result<Account, String>
pub fn build_account(&self) -> Result<Account, String>
Build an account from the form state
Sourcepub fn clear_error(&mut self)
pub fn clear_error(&mut self)
Clear any error message
Trait Implementations§
Source§impl Clone for AccountFormState
impl Clone for AccountFormState
Source§fn clone(&self) -> AccountFormState
fn clone(&self) -> AccountFormState
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 AccountFormState
impl Debug for AccountFormState
Auto Trait Implementations§
impl Freeze for AccountFormState
impl RefUnwindSafe for AccountFormState
impl Send for AccountFormState
impl Sync for AccountFormState
impl Unpin for AccountFormState
impl UnwindSafe for AccountFormState
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