convert T into signals automatically

This commit is contained in:
Evan Almloff committed 2024-01-29 13:36:39 -06:00
1 parent 1847c737e9
commit 50e3216d8b
14 files changed
+441 -103

No files matched your search

+8 -1
View File
@@ -75,6 +75,13 @@ impl<T: 'static> Storage<T> for UnsyncStorage {
fn set(&self, value: T) {
*self.0.borrow_mut() = Some(Box::new(value));
}
fn take(&'static self) -> Option<T> {
self.0
.borrow_mut()
.take()
.map(|any| *any.downcast().unwrap())
}
}
thread_local! {
@@ -128,7 +135,7 @@ impl AnyStorage for UnsyncStorage {
self.0.as_ptr() as *const ()
}
fn take(&self) -> bool {
fn manually_drop(&self) -> bool {
self.0.borrow_mut().take().is_some()
}