convert T into signals automatically
This commit is contained in:
1 parent
1847c737e9
commit
50e3216d8b
14 files changed
+441
-103
No files matched your search
@@ -72,7 +72,7 @@ impl AnyStorage for SyncStorage {
|
||||
self.0.data_ptr() as *const ()
|
||||
}
|
||||
|
||||
fn take(&self) -> bool {
|
||||
fn manually_drop(&self) -> bool {
|
||||
self.0.write().take().is_some()
|
||||
}
|
||||
|
||||
@@ -162,4 +162,11 @@ impl<T: Sync + Send + 'static> Storage<T> for SyncStorage {
|
||||
fn set(&self, value: T) {
|
||||
*self.0.write() = Some(Box::new(value));
|
||||
}
|
||||
|
||||
fn take(&'static self) -> Option<T> {
|
||||
self.0
|
||||
.write()
|
||||
.take()
|
||||
.and_then(|any| any.downcast().ok().map(|boxed| *boxed))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user