|
@@ -1,3 +1,4 @@
|
|
|
+use crate::SignalMap;
|
|
|
use std::{
|
|
|
cell::{Ref, RefCell, RefMut},
|
|
|
ops::{Deref, DerefMut},
|
|
@@ -252,6 +253,11 @@ impl<T: 'static> Signal<T> {
|
|
|
let mut write = self.write();
|
|
|
f(&mut *write)
|
|
|
}
|
|
|
+
|
|
|
+ /// Map the signal to a new type.
|
|
|
+ pub fn map<O>(self, f: fn(&T) -> &O) -> SignalMap<T, O> {
|
|
|
+ SignalMap::new(self, f)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
impl<T: Clone + 'static> Signal<T> {
|