on master help sign in
Use 'todo' instead of 'TODO' for comments in TodoMVC

So they don't look like things we need to fix...

commit320d7d9f4cc54830c7bfbb598c7461487e451619 authorNick Fitzgerald <fitzgen@gmail.com> dateTue 12 Feb 2019, 11:08 (8 years ago) parent1e3cf1f
6 files changed+41−41
examples/todomvc/src/controller.rs+1−1 examples/todomvc/src/lib.rs+1−1 examples/todomvc/src/router.rs+1−1 examples/todomvc/src/todo.rs+14−14 examples/todomvc/src/todos.rs+20−20 examples/todomvc/src/visibility.rs+4−4
examples/todomvc/src/controller.rs+1−1
@@ -15,7 +15,7 @@ use std::ops::{Deref, DerefMut};
1515///
1616/// One could imagine alternative controller implementations with `*Actions`
1717/// trait implementations for (e.g.) testing that will assert various expected
18−/// action methods are called after rendering TODO items and sending DOM events.
18+/// action methods are called after rendering todo items and sending DOM events.
1919#[derive(Default, Deserialize, Serialize)]
2020pub struct Controller;
2121
examples/todomvc/src/lib.rs+1−1
@@ -24,7 +24,7 @@ pub fn run() -> Result<(), JsValue> {
2424 // Set up the logging for debugging if/when things go wrong.
2525 init_logging();
2626
27− // Grab the TODO app container.
27+ // Grab the todo app container.
2828 let document = utils::document();
2929 let container = document
3030 .query_selector(".todoapp")?
examples/todomvc/src/router.rs+1−1
@@ -12,7 +12,7 @@ use wasm_bindgen::JsCast;
1212/// Start the router.
1313pub fn start(vdom: VdomWeak) {
1414 // Callback fired whenever the URL's hash fragment changes. Keeps the root
15− // TODOs collection's visibility in sync with the `#` fragment.
15+ // todos collection's visibility in sync with the `#` fragment.
1616 let on_hash_change = move || {
1717 let new_vis = utils::hash()
1818 .and_then(|hash| {
examples/todomvc/src/todo.rs+14−14
@@ -1,4 +1,4 @@
1−//! Type definition and `dodrio::Render` implementation for a single TODO item.
1+//! Type definition and `dodrio::Render` implementation for a single todo item.
22
33use crate::keys;
44use dodrio::{bumpalo::Bump, on, Attribute, Node, Render, RootRender, VdomWeak};
@@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
66use std::marker::PhantomData;
77use wasm_bindgen::{prelude::*, JsCast};
88
9−/// A single TODO item.
9+/// A single todo item.
1010#[derive(Serialize, Deserialize)]
1111pub struct Todo<C> {
1212 id: usize,
@@ -20,24 +20,24 @@ pub struct Todo<C> {
2020 _controller: PhantomData<C>,
2121}
2222
23−/// Actions on a single TODO item that can be triggered from the UI.
23+/// Actions on a single todo item that can be triggered from the UI.
2424pub trait TodoActions {
25− /// Toggle the completion state of the TODO item with the given id.
25+ /// Toggle the completion state of the todo item with the given id.
2626 fn toggle_completed(root: &mut dyn RootRender, vdom: VdomWeak, id: usize);
2727
28− /// Delete the TODO item with the given id.
28+ /// Delete the todo item with the given id.
2929 fn delete(root: &mut dyn RootRender, vdom: VdomWeak, id: usize);
3030
31− /// Begin editing the TODO item with the given id.
31+ /// Begin editing the todo item with the given id.
3232 fn begin_editing(root: &mut dyn RootRender, vdom: VdomWeak, id: usize);
3333
34− /// Update the edits for the TODO with the given id.
34+ /// Update the edits for the todo with the given id.
3535 fn update_edits(root: &mut dyn RootRender, vdom: VdomWeak, id: usize, edits: String);
3636
37− /// Finish editing the TODO with the given id.
37+ /// Finish editing the todo with the given id.
3838 fn finish_edits(root: &mut dyn RootRender, vdom: VdomWeak, id: usize);
3939
40− /// Cancel editing the TODO with the given id.
40+ /// Cancel editing the todo with the given id.
4141 fn cancel_edits(root: &mut dyn RootRender, vdom: VdomWeak, id: usize);
4242}
4343
@@ -56,7 +56,7 @@ impl<C> Todo<C> {
5656 }
5757 }
5858
59− /// Set this TODO item's id.
59+ /// Set this todo item's id.
6060 pub fn set_id(&mut self, id: usize) {
6161 self.id = id;
6262 }
@@ -71,22 +71,22 @@ impl<C> Todo<C> {
7171 self.completed = to;
7272 }
7373
74− /// Get this TODO's title.
74+ /// Get this todo's title.
7575 pub fn title(&self) -> &str {
7676 &self.title
7777 }
7878
79− /// Set this TODO item's title.
79+ /// Set this todo item's title.
8080 pub fn set_title<S: Into<String>>(&mut self, title: S) {
8181 self.title = title.into();
8282 }
8383
84− /// Set the edits for this TODO.
84+ /// Set the edits for this todo.
8585 pub fn set_edits<S: Into<String>>(&mut self, edits: Option<S>) {
8686 self.edits = edits.map(Into::into);
8787 }
8888
89− /// Take this TODO's edits, leaving `None` in their place.
89+ /// Take this todo's edits, leaving `None` in their place.
9090 pub fn take_edits(&mut self) -> Option<String> {
9191 self.edits.take()
9292 }
examples/todomvc/src/todos.rs+20−20
@@ -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 }
examples/todomvc/src/visibility.rs+4−4
@@ -3,14 +3,14 @@
33use std::fmt;
44use std::str::FromStr;
55
6−/// The visibility filtering for TODO items.
6+/// The visibility filtering for todo items.
77#[derive(Clone, Copy, Eq, PartialEq)]
88pub enum Visibility {
9− /// Show all TODOs.
9+ /// Show all todos.
1010 All,
11− /// Show only active, incomplete TODOs.
11+ /// Show only active, incomplete todos.
1212 Active,
13− /// Show only inactive, completed TODOs.
13+ /// Show only inactive, completed todos.
1414 Completed,
1515}
1616