@@ -1,5 +1,5 @@
11//! Type definitions and `dodrio::Render` implementation for a collection of
2−//! TODO items.
2+//! todo items.
33
44use crate::controller::Controller;
55use crate::todo::{Todo, TodoActions};
@@ -15,7 +15,7 @@ use std::mem;
1515use wasm_bindgen::prelude::*;
1616use wasm_bindgen::JsCast;
1717
18−/// A collection of TODOs.
18+/// A collection of todos.
1919#[derive(Default, Serialize, Deserialize)]
2020#[serde(rename = "todos-dodrio", bound = "")]
2121pub struct Todos<C = Controller> {
@@ -33,25 +33,25 @@ pub struct Todos<C = Controller> {
3333
3434/// Actions for `Todos` that can be triggered by UI interactions.
3535pub trait TodosActions: TodoActions {
36− /// Toggle the completion state of all TODO items.
36+ /// Toggle the completion state of all todo items.
3737 fn toggle_all(root: &mut dyn RootRender, vdom: VdomWeak);
3838
39− /// Update the draft TODO item's text.
39+ /// Update the draft todo item's text.
4040 fn update_draft(root: &mut dyn RootRender, vdom: VdomWeak, draft: String);
4141
42− /// Finish the current draft TODO item and add it to the collection of
43− /// TODOs.
42+ /// Finish the current draft todo item and add it to the collection of
43+ /// todos.
4444 fn finish_draft(root: &mut dyn RootRender, vdom: VdomWeak);
4545
46− /// Change the TODO item visibility filtering to the given `Visibility`.
46+ /// Change the todo item visibility filtering to the given `Visibility`.
4747 fn change_visibility(root: &mut dyn RootRender, vdom: VdomWeak, vis: Visibility);
4848
49− /// Delete all completed TODO items.
49+ /// Delete all completed todo items.
5050 fn delete_completed(root: &mut dyn RootRender, vdom: VdomWeak);
5151}
5252
5353impl<C> Todos<C> {
54− /// Construct a new TODOs set.
54+ /// Construct a new todos set.
5555 ///
5656 /// If an existing set is available in local storage, then us that,
5757 /// otherwise create a new set.
@@ -62,7 +62,7 @@ impl<C> Todos<C> {
6262 Self::from_local_storage().unwrap_or_default()
6363 }
6464
65− /// Deserialize a set of TODOs from local storage.
65+ /// Deserialize a set of todos from local storage.
6666 pub fn from_local_storage() -> Option<Self> {
6767 utils::local_storage()
6868 .get("todomvc-dodrio")
@@ -71,7 +71,7 @@ impl<C> Todos<C> {
7171 .and_then(|json| serde_json::from_str(&json).ok())
7272 }
7373
74− /// Serialize this set of TODOs to local storage.
74+ /// Serialize this set of todos to local storage.
7575 pub fn save_to_local_storage(&self) {
7676 let serialized = serde_json::to_string(self).unwrap_throw();
7777 utils::local_storage()
@@ -79,41 +79,41 @@ impl<C> Todos<C> {
7979 .unwrap_throw();
8080 }
8181
82− /// Add a new TODO item to this collection.
82+ /// Add a new todo item to this collection.
8383 pub fn add_todo(&mut self, todo: Todo<C>) {
8484 self.todos.push(todo);
8585 }
8686
87− /// Delete the TODO with the given id.
87+ /// Delete the todo with the given id.
8888 pub fn delete_todo(&mut self, id: usize) {
8989 self.todos.remove(id);
9090 self.fix_ids();
9191 }
9292
93− /// Delete all completed TODO items.
93+ /// Delete all completed todo items.
9494 pub fn delete_completed(&mut self) {
9595 self.todos.retain(|t| !t.is_complete());
9696 self.fix_ids();
9797 }
9898
99− // Fix all TODO identifiers so that they match their index once again.
99+ // Fix all todo identifiers so that they match their index once again.
100100 fn fix_ids(&mut self) {
101101 for (id, todo) in self.todos.iter_mut().enumerate() {
102102 todo.set_id(id);
103103 }
104104 }
105105
106− /// Get a shared slice of the underlying set of TODO items.
106+ /// Get a shared slice of the underlying set of todo items.
107107 pub fn todos(&self) -> &[Todo<C>] {
108108 &self.todos
109109 }
110110
111− /// Get an exclusive slice of the underlying set of TODO items.
111+ /// Get an exclusive slice of the underlying set of todo items.
112112 pub fn todos_mut(&mut self) -> &mut [Todo<C>] {
113113 &mut self.todos
114114 }
115115
116− /// Set the draft TODO item text.
116+ /// Set the draft todo item text.
117117 pub fn set_draft<S: Into<String>>(&mut self, draft: S) {
118118 self.draft = draft.into();
119119 }
@@ -123,12 +123,12 @@ impl<C> Todos<C> {
123123 mem::replace(&mut self.draft, String::new())
124124 }
125125
126− /// Get the current visibility for these TODOs.
126+ /// Get the current visibility for these todos.
127127 pub fn visibility(&self) -> Visibility {
128128 self.visibility
129129 }
130130
131− /// Set the visibility for these TODOS.
131+ /// Set the visibility for these todoS.
132132 pub fn set_visibility(&mut self, vis: Visibility) {
133133 self.visibility = vis;
134134 }