From 8412ba6236e2f8e9461dbce6d9e215c0743bc5e2 Mon Sep 17 00:00:00 2001 From: Oliver Nordh Date: Thu, 19 Dec 2024 07:04:57 +0100 Subject: [PATCH] fix: doctests on for_loop --- leptos/src/for_loop.rs | 62 ++++++++++++++++++++++++++++++++---------- 1 file changed, 48 insertions(+), 14 deletions(-) diff --git a/leptos/src/for_loop.rs b/leptos/src/for_loop.rs index 7a2e782b85..4c64b39174 100644 --- a/leptos/src/for_loop.rs +++ b/leptos/src/for_loop.rs @@ -49,13 +49,30 @@ use tachys::{reactive_graph::OwnedView, view::keyed::keyed}; /// component, using the `let` syntax: /// /// ``` -/// -/// -/// +/// # use leptos::prelude::*; +/// +/// # #[derive(Copy, Clone, Debug, PartialEq, Eq)] +/// # struct Counter { +/// # id: usize, +/// # count: RwSignal +/// # } +/// # +/// # #[component] +/// # fn Counters() -> impl IntoView { +/// # let (counters, set_counters) = create_signal::>(vec![]); +/// # +/// view! { +///
+/// +/// +/// +///
+/// } +/// # } /// ``` /// /// The `let` syntax also supports destructuring the pattern of your data. @@ -63,13 +80,30 @@ use tachys::{reactive_graph::OwnedView, view::keyed::keyed}; /// in the case of structs. /// /// ``` -/// -/// -/// +/// # use leptos::prelude::*; +/// +/// # #[derive(Copy, Clone, Debug, PartialEq, Eq)] +/// # struct Counter { +/// # id: usize, +/// # count: RwSignal +/// # } +/// # +/// # #[component] +/// # fn Counters() -> impl IntoView { +/// # let (counters, set_counters) = create_signal::>(vec![]); +/// # +/// view! { +///
+/// +/// +/// +///
+/// } +/// # } /// ``` #[cfg_attr(feature = "tracing", tracing::instrument(level = "trace", skip_all))] #[component]