浏览代码

Simplify TodoMVC example (#2935)

* Remove id field from TodoItem

* Remove derived traits from TodoItem
Matt Hunzinger 9 月之前
父节点
当前提交
2733497038
共有 1 个文件被更改,包括 0 次插入3 次删除
  1. 0 3
      examples/todomvc.rs

+ 0 - 3
examples/todomvc.rs

@@ -16,9 +16,7 @@ enum FilterState {
     Completed,
 }
 
-#[derive(Debug, PartialEq, Eq)]
 struct TodoItem {
-    id: u32,
     checked: bool,
     contents: String,
 }
@@ -120,7 +118,6 @@ fn TodoHeader(mut todos: Signal<HashMap<u32, TodoItem>>) -> Element {
         if evt.key() == Key::Enter && !draft.read().is_empty() {
             let id = todo_id();
             let todo = TodoItem {
-                id,
                 checked: false,
                 contents: draft.to_string(),
             };