feat: impl Copy & Clone for MaybeSignal (#660)

This commit is contained in:
Charles Taylor 2023-03-11 13:17:16 -05:00 committed by GitHub
parent 591212a56a
commit 9d46b7bcb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -516,6 +516,17 @@ where
Dynamic(Signal<T>),
}
impl<T: Clone> Clone for MaybeSignal<T> {
fn clone(&self) -> Self {
match self {
Self::Static(item) => Self::Static(item.clone()),
Self::Dynamic(signal) => Self::Dynamic(signal.clone()),
}
}
}
impl<T: Copy> Copy for MaybeSignal<T> {}
impl<T: Default> Default for MaybeSignal<T> {
fn default() -> Self {
Self::Static(Default::default())