simplify reactive context and expose less signal internals

This commit is contained in:
Evan Almloff committed 2024-02-05 08:05:27 -06:00
1 parent 8324f5290a
commit 30bac267c9
7 files changed
+53 -81

No files matched your search

+7 -1
View File
@@ -14,8 +14,14 @@ pub trait Readable<T: 'static = ()> {
f: F,
) -> Option<Self::Ref<U>>;
/// Try to 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.
fn try_read(&self) -> Result<Self::Ref<T>, generational_box::BorrowError>;
/// 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.
fn read(&self) -> Self::Ref<T>;
#[track_caller]
fn read(&self) -> Self::Ref<T> {
self.try_read().unwrap()
}
/// Get the current value of the state without subscribing to updates. If the value has been dropped, this will panic.
fn peek(&self) -> Self::Ref<T>;