feat: From<ArcRwSignal<_>> for ArcMemo<_>

This commit is contained in:
Greg Johnston 2024-08-11 17:19:35 -04:00
parent 4fa2e58551
commit 7ed4d08dab

View file

@ -7,7 +7,7 @@ use crate::{
owner::{Storage, StorageAccess, SyncStorage},
signal::{
guards::{Mapped, Plain, ReadGuard},
ArcReadSignal,
ArcReadSignal, ArcRwSignal,
},
traits::{DefinedAt, Get, ReadUntracked},
};
@ -347,3 +347,13 @@ where
ArcMemo::new(move |_| value.get())
}
}
impl<T> From<ArcRwSignal<T>> for ArcMemo<T, SyncStorage>
where
T: Clone + PartialEq + Send + Sync + 'static,
{
#[track_caller]
fn from(value: ArcRwSignal<T>) -> Self {
ArcMemo::new(move |_| value.get())
}
}