Struct tdo_core::list::TodoList
[−]
[src]
pub struct TodoList { pub name: String, pub list: Vec<Todo>, }
Simple todo list structure.
Todos can be grouped together in so called todo lists (as in the real world).
Therefore, the TodoList
struct can be used. It's a simple data structure that holds a
number of Todo
items and offers all basic functions for managing them.
Fields
name: String
Name of the todo list.
list: Vec<Todo>
The actual vector of Todo
items.
Methods
impl TodoList
[src]
fn new(name: &str) -> TodoList
fn add(&mut self, new_todo: Todo)
fn contains_id(&self, id: u32) -> TdoResult<usize>
Check if the list contains a todo with the given ID.
This function returns a TdoResult
, wich will contion a TodoError::NotInList
if the list does not contain any todo with the given ID or the position in the list.
fn done_id(&mut self, id: u32) -> TdoResult<()>
Mark a todo from the list with the given ID as done.
This function returns a TdoResult
, which will contain a TodoError::NotInList
if the list does not contain any todo with the given ID.
fn remove_id(&mut self, id: u32) -> TdoResult<Todo>
Remove a todo with the given ID from the list.
This function returns a TdoResult
, which will contain the removed Todo itself or a
TodoError::NotInList
if the list does not contain any todo with the given id.
fn list_undone(&self) -> Vec<Todo>
Search for all undone todos in the list.
Returns a vector of all undone todos.
fn clean(&mut self)
Remove all done todos from the list.
fn pop_id(&mut self, todo_id: u32) -> TdoResult<Todo>
Remove a todo with a specific ID from the list.
fn insert_todo(&mut self, todo: Todo)
Insert an existing todo into the list, preserving the ordering of the internal list.
Trait Implementations
impl Debug for TodoList
[src]
impl Clone for TodoList
[src]
fn clone(&self) -> TodoList
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Default for TodoList
[src]
Instanciates a default TodoList
.
This function is invoked when a Tdo
container structure is instanciated.