Make EventHandler copy (#2112)

* implement Copy for EventHandler
* implement from closure for event handler and remove special on prefix
* fix props implementation of EventHandler
This commit is contained in:
Evan Almloff authored and GitHub committed 2024-03-19 19:48:53 -07:00
1 parent 4bb807a3ce
commit 58f7efafea
19 files changed
+755 -364

No files matched your search

+4 -4
View File
@@ -51,7 +51,7 @@ pub struct GenerationalBox<T, S: 'static = UnsyncStorage> {
_marker: PhantomData<T>,
}
impl<T: 'static, S: AnyStorage> Debug for GenerationalBox<T, S> {
impl<T, S: AnyStorage> Debug for GenerationalBox<T, S> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
#[cfg(any(debug_assertions, feature = "check_generation"))]
f.write_fmt(format_args!(
@@ -65,7 +65,7 @@ impl<T: 'static, S: AnyStorage> Debug for GenerationalBox<T, S> {
}
}
impl<T: 'static, S: Storage<T>> GenerationalBox<T, S> {
impl<T, S: Storage<T>> GenerationalBox<T, S> {
#[inline(always)]
pub(crate) fn validate(&self) -> bool {
#[cfg(any(debug_assertions, feature = "check_generation"))]
@@ -196,7 +196,7 @@ impl<T: 'static, S: Storage<T>> GenerationalBox<T, S> {
}
}
impl<T, S: 'static> Copy for GenerationalBox<T, S> {}
impl<T, S> Copy for GenerationalBox<T, S> {}
impl<T, S> Clone for GenerationalBox<T, S> {
fn clone(&self) -> Self {
@@ -362,7 +362,7 @@ impl<S> MemoryLocation<S> {
}
}
fn replace_with_caller<T: 'static>(
fn replace_with_caller<T>(
&mut self,
value: T,
#[cfg(any(debug_assertions, feature = "debug_ownership"))]
+3 -3
View File
@@ -68,7 +68,7 @@ pub struct GenerationalRefMut<W> {
pub(crate) borrow: GenerationalRefMutBorrowInfo,
}
impl<T: 'static, R: DerefMut<Target = T>> GenerationalRefMut<R> {
impl<T, R: DerefMut<Target = T>> GenerationalRefMut<R> {
pub(crate) fn new(
inner: R,
#[cfg(any(debug_assertions, feature = "debug_borrows"))]
@@ -82,7 +82,7 @@ impl<T: 'static, R: DerefMut<Target = T>> GenerationalRefMut<R> {
}
}
impl<T: ?Sized + 'static, W: DerefMut<Target = T>> Deref for GenerationalRefMut<W> {
impl<T: ?Sized, W: DerefMut<Target = T>> Deref for GenerationalRefMut<W> {
type Target = T;
fn deref(&self) -> &Self::Target {
@@ -90,7 +90,7 @@ impl<T: ?Sized + 'static, W: DerefMut<Target = T>> Deref for GenerationalRefMut<
}
}
impl<T: ?Sized + 'static, W: DerefMut<Target = T>> DerefMut for GenerationalRefMut<W> {
impl<T: ?Sized, W: DerefMut<Target = T>> DerefMut for GenerationalRefMut<W> {
fn deref_mut(&mut self) -> &mut Self::Target {
self.inner.deref_mut()
}