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:
1 parent
668d5415c8
commit
b47a6cf83e
13 files changed
+281
-289
No files matched your search
@@ -221,8 +221,11 @@ pub trait Readable {
|
||||
<Self::Storage as AnyStorage>::map(self.read(), |v| v.index(index))
|
||||
}
|
||||
|
||||
/// SAFETY: You must call this function directly with `self` as the argument.
|
||||
/// This function relies on the size of the object you return from the deref
|
||||
/// being the same as the object you pass in
|
||||
#[doc(hidden)]
|
||||
fn deref_impl<'a>(&self) -> &'a dyn Fn() -> Self::Target
|
||||
unsafe fn deref_impl<'a>(&self) -> &'a dyn Fn() -> Self::Target
|
||||
where
|
||||
Self: Sized + 'a,
|
||||
Self::Target: Clone,
|
||||
|
||||
Reference in new issue
Block a user