simplify the readable and writable traits a bit

This commit is contained in:
Evan Almloff committed 2024-01-23 12:07:55 -06:00
1 parent c172914b21
commit 6bc0332052
7 files changed
+20 -49

No files matched your search

+1 -3
View File
@@ -51,7 +51,7 @@ impl<T: PartialEq + 'static> GlobalMemo<T> {
}
}
impl<T: PartialEq + 'static> crate::ReadableRef for GlobalMemo<T> {
impl<T: PartialEq + 'static> Readable<T> for GlobalMemo<T> {
type Ref<R: ?Sized + 'static> = generational_box::GenerationalRef<std::cell::Ref<'static, R>>;
fn map_ref<I, U: ?Sized, F: FnOnce(&I) -> &U>(ref_: Self::Ref<I>, f: F) -> Self::Ref<U> {
@@ -64,9 +64,7 @@ impl<T: PartialEq + 'static> crate::ReadableRef for GlobalMemo<T> {
) -> Option<Self::Ref<U>> {
<UnsyncStorage as AnyStorage>::try_map(ref_, f)
}
}
impl<T: PartialEq + 'static> Readable<T> for GlobalMemo<T> {
#[track_caller]
fn read(&self) -> Self::Ref<T> {
self.signal().read()