allow conversion directly from Arc signal types to MaybeSignal

This commit is contained in:
Greg Johnston 2024-06-21 20:16:54 -04:00
parent ba8bd2bc82
commit 35f489a52e
1 changed files with 18 additions and 0 deletions

View File

@ -490,6 +490,24 @@ pub mod read {
}
}
impl<T: Send + Sync> From<ArcReadSignal<T>> for MaybeSignal<T> {
fn from(value: ArcReadSignal<T>) -> Self {
ReadSignal::from(value).into()
}
}
impl<T: Send + Sync> From<ArcRwSignal<T>> for MaybeSignal<T> {
fn from(value: ArcRwSignal<T>) -> Self {
RwSignal::from(value).into()
}
}
impl<T: Send + Sync> From<ArcMemo<T>> for MaybeSignal<T> {
fn from(value: ArcMemo<T>) -> Self {
Memo::from(value).into()
}
}
impl<T> From<Signal<T>> for MaybeSignal<T> {
fn from(value: Signal<T>) -> Self {
Self::Dynamic(value)