removed clone bount on the type argument of SignalSetter

This commit is contained in:
Jose Quesada 2022-12-28 21:14:10 -06:00
parent 63e70db736
commit 67c5eda099

View file

@ -29,11 +29,17 @@ use crate::{RwSignal, Scope, WriteSignal};
/// assert_eq!(count(), 8);
/// # });
/// ```
#[derive(Clone, Debug, PartialEq, Eq)]
#[derive(Debug, PartialEq, Eq)]
pub struct SignalSetter<T>(SignalSetterTypes<T>)
where
T: 'static;
impl<T> Clone for SignalSetter<T> {
fn clone(&self) -> Self {
Self(self.0.clone())
}
}
impl<T> SignalSetter<T>
where
T: 'static,
@ -103,7 +109,6 @@ impl<T> From<RwSignal<T>> for SignalSetter<T> {
}
}
#[derive(Clone)]
enum SignalSetterTypes<T>
where
T: 'static,
@ -112,6 +117,15 @@ where
Mapped(Scope, Rc<dyn Fn(T)>),
}
impl<T> Clone for SignalSetterTypes<T> {
fn clone(&self) -> Self {
match self {
Self::Write(arg0) => Self::Write(*arg0),
Self::Mapped(cx, f) => Self::Mapped(*cx, f.clone()),
}
}
}
impl<T> std::fmt::Debug for SignalSetterTypes<T>
where
T: std::fmt::Debug,