reactive_signals/signals/types/
client.rs1use super::{OptReadable, SignalType};
2
3pub struct ClientFunc<T>(pub(crate) T);
5
6impl<T> OptReadable for ClientFunc<T> {
7 const RUN_ON_SERVER: bool = false;
8}
9
10impl<T: 'static> SignalType for ClientFunc<T> {
11 type Inner = T;
12
13 fn inner(&self) -> &Self::Inner {
14 &self.0
15 }
16 fn inner_mut(&mut self) -> &mut Self::Inner {
17 &mut self.0
18 }
19 fn new(value: Self::Inner) -> Self {
20 Self(value)
21 }
22}
23
24pub struct ClientEqFunc<T>(pub(crate) T);
26
27impl<T> OptReadable for ClientEqFunc<T> {}
28
29impl<T: 'static + PartialEq> SignalType for ClientEqFunc<T> {
30 type Inner = T;
31
32 fn is_eq(&self, other: &Self::Inner) -> bool {
33 self.0 == *other
34 }
35
36 fn inner(&self) -> &Self::Inner {
37 &self.0
38 }
39 fn inner_mut(&mut self) -> &mut Self::Inner {
40 &mut self.0
41 }
42 fn new(value: Self::Inner) -> Self {
43 Self(value)
44 }
45}