pub struct State {
pub ids: Vec<i32>,
pub tasks: HashMap<i32, ListItem>,
pub selected: Option<usize>,
}Expand description
The overall state of application
Fields§
§ids: Vec<i32>§tasks: HashMap<i32, ListItem>§selected: Option<usize>index of selected task
Implementations§
Source§impl State
impl State
pub fn new() -> Self
Sourcepub fn move_selection(&mut self, upwards: bool)
pub fn move_selection(&mut self, upwards: bool)
Move app state selection
Sourcepub fn remove_task(&mut self, id: &i32) -> Option<()>
pub fn remove_task(&mut self, id: &i32) -> Option<()>
remove task with given id
Sourcepub fn remove_task_by_seq(&mut self, idx: usize)
pub fn remove_task_by_seq(&mut self, idx: usize)
delete a particular task at an index from the given state
Sourcepub fn toggle_task_status(&mut self, idx: usize) -> Option<bool>
pub fn toggle_task_status(&mut self, idx: usize) -> Option<bool>
mark incomplete task complete and vice versa
returns true if task marked as complete else false
Sourcepub fn toggle_task_status_by_id(&mut self, id: i32) -> Option<bool>
pub fn toggle_task_status_by_id(&mut self, id: i32) -> Option<bool>
mark incomplete task complete and vice versa
returns true if task marked as complete else false
Trait Implementations§
Auto Trait Implementations§
impl Freeze for State
impl RefUnwindSafe for State
impl Send for State
impl Sync for State
impl Unpin for State
impl UnwindSafe for State
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> 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