implement readable and callable for all structs in the hooks crate

This commit is contained in:
Evan Almloff committed 2024-03-08 11:17:28 -06:00
1 parent 98158bdc6f
commit ffc49530f6
13 files changed
+167 -491

No files matched your search

+3 -2
View File
@@ -25,8 +25,9 @@ use futures_util::StreamExt;
/// ```
#[track_caller]
pub fn use_memo<R: PartialEq>(f: impl FnMut() -> R + 'static) -> Memo<R> {
let mut callback = use_callback(f);
use_hook(|| Signal::memo(move || callback.call()))
let callback = use_callback(f);
#[allow(clippy::redundant_closure)]
use_hook(|| Signal::memo(move || callback()))
}
/// Creates a new unsync Selector with some local dependencies. The selector will be run immediately and whenever any signal it reads or any dependencies it tracks changes