Fix error in examples/future.rs comments, use_futures inline docs comments, also added clarification that Signal<T>.read() and Singal<T>() are the same thing

This commit is contained in:
andrey committed 2024-02-28 11:42:04 +08:00
1 parent 5a73147d69
commit 70136b22ea
11 files changed
+164 -5

No files matched your search

+1 -1
View File
@@ -42,7 +42,7 @@ pub fn use_context<T: 'static + Clone>() -> T {
/// use_context_provider(|| Signal::new(0));
/// rsx! { Child {} }
///}
// This component does read from the signal, so when the signal changes it will rerun
/// // This component does read from the signal, so when the signal changes it will rerun
///#[component]
///fn Child() -> Element {
/// let signal: Signal<i32> = use_context();
+1 -1
View File
@@ -12,7 +12,7 @@ use std::future::Future;
/// This future will **not** run on the server
/// The future is spawned on the next call to `flush_sync` which means that it will not run on the server.
/// To run a future on the server, you should use `spawn` directly.
/// `use_future` assumes your future will never complete - **it won't return a value**.
/// `use_future` **won't return a value**.
/// If you want to return a value, use `use_resource` instead.
/// ```rust
/// fn app() -> Element {
+3 -1
View File
@@ -39,7 +39,9 @@ pub trait Readable {
MappedSignal::new(try_read, peek)
}
/// Get the current value of the state. If this is a signal, this will subscribe the current scope to the signal. If the value has been dropped, this will panic.
/// Get the current value of the state. If this is a signal, this will subscribe the current scope to the signal.
/// If the value has been dropped, this will panic. Calling this on a Signal is the same as
/// using the signal() syntax to read and subscribe to its value
#[track_caller]
fn read(&self) -> ReadableRef<Self> {
self.try_read().unwrap()