Move to a generic GlobalLazy<T> (#2851)

* Expose a generic lazy type

* Switch to generic lazy globals

* simplify global lazy context a bit

* rename LazyGlobal to Global

* use Memo::global in more examples

* Fix soundness issue with deref_impl. It relies on the size of self, so it cannot be safe

* add a comment about safety

* Make clippy happy

* fix formatting

* Restore changes to signal impl

* Add helper methods for global signal and global memo to make getting the inner value easier
This commit is contained in:
Evan Almloff authored and GitHub committed 2024-08-16 17:57:41 -05:00
1 parent 668d5415c8
commit b47a6cf83e
13 files changed
+281 -289

No files matched your search

+1 -1
View File
@@ -189,6 +189,6 @@ impl Deref for UseFuture {
type Target = dyn Fn() -> UseFutureState;
fn deref(&self) -> &Self::Target {
Readable::deref_impl(self)
unsafe { Readable::deref_impl(self) }
}
}
+1 -1
View File
@@ -473,6 +473,6 @@ impl<T: Clone> Deref for Resource<T> {
type Target = dyn Fn() -> Option<T>;
fn deref(&self) -> &Self::Target {
Readable::deref_impl(self)
unsafe { Readable::deref_impl(self) }
}
}