docs: minor fixes for some code examples in the book (#2077)

This commit is contained in:
Rockie Guo 2023-11-29 08:53:26 +08:00 committed by GitHub
parent 75c27e0b85
commit 9c44da2594
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -135,17 +135,17 @@ pub fn App() -> impl IntoView {
} }
#[component] #[component]
pub fn Outer(ChildrenFn) -> impl IntoView { pub fn Outer(children: ChildrenFn) -> impl IntoView {
children() children()
} }
#[component] #[component]
pub fn Inner(ChildrenFn) -> impl IntoView { pub fn Inner(children: ChildrenFn) -> impl IntoView {
children() children()
} }
#[component] #[component]
pub fn Inmost(ng) -> impl IntoView { pub fn Inmost(name: String) -> impl IntoView {
view! { view! {
<p>{name}</p> <p>{name}</p>
} }

View File

@ -30,7 +30,7 @@ pub struct Todos(Vec<Todo>);
impl Todos { impl Todos {
pub fn num_remaining(&self) -> usize { pub fn num_remaining(&self) -> usize {
todos.iter().filter(|todo| !todo.completed).sum() self.0.iter().filter(|todo| !todo.completed).sum()
} }
} }