chore: fix broken doctests in leptos_reactive

This commit is contained in:
Greg Johnston 2023-10-24 15:35:16 -04:00
parent fdd4b3d919
commit e2842ede44

View file

@ -72,16 +72,16 @@ use std::{
/// ```rust /// ```rust
/// # use leptos::*; /// # use leptos::*;
/// # let runtime = create_runtime(); /// # let runtime = create_runtime();
/// # runtime.dispose(): /// # if false {
/// # let how_many_cats = RwSignal::new(0); let how_many_dogs = RwSignal::new(0);
/// // Single signal. `Resource` will run once initially and then every time `how_many_cats` changes /// // Single signal. `Resource` will run once initially and then every time `how_many_cats` changes
/// let async_data = create_resource(move || how_many_cats.get() , |_| async move { todo!() }); /// let async_data = create_resource(move || how_many_cats.get() , |_| async move { todo!() });
/// // Non-reactive signal. `Resource` runs only once /// // Non-reactive signal. `Resource` runs only once
/// let async_data = create_resource(|| (), |_| async move { todo!() }); /// let async_data = create_resource(|| (), |_| async move { todo!() });
/// // Multiple signals. `Resource` will run once initially and then every time `how_many_cats` or `how_many_dogs` changes /// // Multiple signals. `Resource` will run once initially and then every time `how_many_cats` or `how_many_dogs` changes
/// let async_data = create_resource(move || (how_many_cats.get(), how_many_dogs.get()), |_| async move { todo!() }); /// let async_data = create_resource(move || (how_many_cats.get(), how_many_dogs.get()), |_| async move { todo!() });
/// # runtime.dispose(); /// # runtime.dispose();
/// # }
/// ``` /// ```
#[cfg_attr( #[cfg_attr(
any(debug_assertions, feature="ssr"), any(debug_assertions, feature="ssr"),
@ -933,16 +933,16 @@ impl<S, T> SignalSet for Resource<S, T> {
/// ```rust /// ```rust
/// # use leptos::*; /// # use leptos::*;
/// # let runtime = create_runtime(); /// # let runtime = create_runtime();
/// # runtime.dispose(): /// # if false {
/// # let how_many_cats = RwSignal::new(0); let how_many_dogs = RwSignal::new(0);
/// // Single signal. `Resource` will run once initially and then every time `how_many_cats` changes /// // Single signal. `Resource` will run once initially and then every time `how_many_cats` changes
/// let async_data = create_resource(move || how_many_cats.get() , |_| async move { todo!() }); /// let async_data = create_resource(move || how_many_cats.get() , |_| async move { todo!() });
/// // Non-reactive signal. `Resource` runs only once /// // Non-reactive signal. `Resource` runs only once
/// let async_data = create_resource(|| (), |_| async move { todo!() }); /// let async_data = create_resource(|| (), |_| async move { todo!() });
/// // Multiple signals. `Resource` will run once initially and then every time `how_many_cats` or `how_many_dogs` changes /// // Multiple signals. `Resource` will run once initially and then every time `how_many_cats` or `how_many_dogs` changes
/// let async_data = create_resource(move || (how_many_cats.get(), how_many_dogs.get()), |_| async move { todo!() }); /// let async_data = create_resource(move || (how_many_cats.get(), how_many_dogs.get()), |_| async move { todo!() });
/// # runtime.dispose(); /// # runtime.dispose();
/// # }
/// ``` /// ```
#[derive(Debug, PartialEq, Eq, Hash)] #[derive(Debug, PartialEq, Eq, Hash)]
pub struct Resource<S, T> pub struct Resource<S, T>