Diffstat (limited to 'src/any/static_wrapper.rs')
-rw-r--r--src/any/static_wrapper.rs30
1 files changed, 11 insertions, 19 deletions
diff --git a/src/any/static_wrapper.rs b/src/any/static_wrapper.rs
index efc6839..6184509 100644
--- a/src/any/static_wrapper.rs
+++ b/src/any/static_wrapper.rs
@@ -1,18 +1,16 @@
//! Wrapper types that impl [`TypeName`] when their generic type `T` is `'static`.
-use effectful::forward_send_sync;
+use effectful::SendSync;
use crate::hkt::Marker;
use super::*;
/// Owned static `T`.
-#[derive(PartialEq, Clone, Copy, Debug)]
+#[derive(PartialEq, Clone, Copy, Debug, SendSync)]
#[repr(transparent)]
pub struct OwnedStatic<T: ?Sized>(pub T);
-forward_send_sync!({T: (?Sized)} {} OwnedStatic<T>);
-
impl<'a, 'ctx, E: EnvConfig, T> TypeName::MemberTypeForLt<'a, 'ctx, E, &'a &'ctx ()>
for OwnedStatic<T>
where
@@ -30,12 +28,11 @@ where
}
/// Borrowed static `T` for `'ctx`.
-#[derive(PartialEq, Clone, Copy, Debug)]
+#[derive(PartialEq, Clone, Copy, Debug, SendSync)]
#[repr(transparent)]
pub struct BorrowedStatic<'ctx, T: ?Sized>(pub &'ctx T);
-forward_send_sync!({} {T: (?Sized + 'ctx)} {{'ctx}} BorrowedStatic<'ctx, T>);
-
+#[derive(SendSync)]
pub struct BorrowedStaticHrt<T: ?Sized>(Marker<T>);
impl<'a, 'ctx, E: EnvConfig, T: ?Sized> TypeName::MemberTypeForLt<'a, 'ctx, E, &'a &'ctx ()>
@@ -55,12 +52,11 @@ where
}
/// Borrowed static `T` for `'a`.
-#[derive(PartialEq, Clone, Copy, Debug)]
+#[derive(PartialEq, Clone, Copy, Debug, SendSync)]
#[repr(transparent)]
pub struct TempBorrowedStatic<'a, T: ?Sized>(pub &'a T);
-forward_send_sync!({} {T: (?Sized + 'ctx)} {{'ctx}} TempBorrowedStatic<'ctx, T>);
-
+#[derive(SendSync)]
pub struct TempBorrowedStaticHrt<T: ?Sized>(Marker<T>);
impl<'a, 'ctx, E: EnvConfig, T: ?Sized> TypeName::MemberTypeForLt<'a, 'ctx, E, &'a &'ctx ()>
@@ -80,12 +76,11 @@ where
}
/// Mutably borrowed static `T` for `'ctx`.
-#[derive(PartialEq, Debug)]
+#[derive(PartialEq, Debug, SendSync)]
#[repr(transparent)]
pub struct BorrowedMutStatic<'ctx, T: ?Sized>(pub &'ctx mut T);
-forward_send_sync!({T: (?Sized + 'ctx)} {} {{'ctx}} BorrowedMutStatic<'ctx, T>);
-
+#[derive(SendSync)]
pub struct BorrowedMutStaticHrt<T: ?Sized>(Marker<T>);
impl<'a, 'ctx, E: EnvConfig, T: ?Sized> TypeName::MemberTypeForLt<'a, 'ctx, E, &'a &'ctx ()>
@@ -105,12 +100,11 @@ where
}
/// Mutably borrowed static `T` for `'a`.
-#[derive(PartialEq, Debug)]
+#[derive(PartialEq, Debug, SendSync)]
#[repr(transparent)]
pub struct TempBorrowedMutStatic<'a, T: ?Sized>(pub &'a mut T);
-forward_send_sync!({T: (?Sized + 'ctx)} {} {{'ctx}} TempBorrowedMutStatic<'ctx, T>);
-
+#[derive(SendSync)]
pub struct TempBorrowedMutStaticHrt<T: ?Sized>(Marker<T>);
impl<'a, 'ctx, E: EnvConfig, T: ?Sized> TypeName::MemberTypeForLt<'a, 'ctx, E, &'a &'ctx ()>
@@ -131,13 +125,11 @@ where
/// Boxed static `T`.
#[cfg(feature = "alloc")]
+#[derive(SendSync)]
#[repr(transparent)]
pub struct BoxedStatic<T: ?Sized>(pub Box<T>);
#[cfg(feature = "alloc")]
-forward_send_sync!({T: (?Sized)} {} BoxedStatic<T>);
-
-#[cfg(feature = "alloc")]
impl<'a, 'ctx, E: EnvConfig, T: ?Sized> TypeName::MemberTypeForLt<'a, 'ctx, E, &'a &'ctx ()>
for BoxedStatic<T>
where