Diffstat (limited to 'src/any/static_wrapper.rs')
| -rw-r--r-- | src/any/static_wrapper.rs | 44 |
1 files changed, 16 insertions, 28 deletions
diff --git a/src/any/static_wrapper.rs b/src/any/static_wrapper.rs index 4b238b9..c99b037 100644 --- a/src/any/static_wrapper.rs +++ b/src/any/static_wrapper.rs @@ -7,19 +7,14 @@ use super::*; #[repr(transparent)] pub struct OwnedStatic<T: ?Sized>(pub T); -/// Higher ranked type for [`OwnedStatic`]. -pub struct DynOwnedStatic<T: ?Sized>(PhantomData<fn() -> *const T>); - -impl<'a, 'ctx, T: ?Sized + 'ctx> WithContextLt::LowerForLt<'a, 'ctx, &'a (&'ctx (),)> - for DynOwnedStatic<T> -{ - type T = OwnedStatic<T>; -} - -impl<'a, 'ctx, T: ?Sized + 'ctx> WithContextLt::RaiseForLt<'a, 'ctx, &'a (&'ctx (),)> - for OwnedStatic<T> -{ - type HigherRanked = DynOwnedStatic<T>; +bijective_higher_ranked_type! { + /// Higher ranked type for [`OwnedStatic`]. + pub for['ctx] type DynOwnedStatic[][T]: WithContextLt['ctx][] + for<'a> + (OwnedStatic<T>) + where { + T: ?Sized + 'ctx, + } } bijective_higher_ranked_type! { @@ -128,22 +123,15 @@ bijective_higher_ranked_type! { #[repr(transparent)] pub struct BoxedStatic<T: ?Sized>(pub Box<T>); -/// Higher ranked type for [`BoxedStatic`]. -#[cfg(feature = "alloc")] -pub struct DynBoxedStatic<T: ?Sized>(PhantomData<fn() -> *const T>); - #[cfg(feature = "alloc")] -impl<'a, 'ctx, T: ?Sized + 'ctx> WithContextLt::LowerForLt<'a, 'ctx, &'a (&'ctx (),)> - for DynBoxedStatic<T> -{ - type T = BoxedStatic<T>; -} - -#[cfg(feature = "alloc")] -impl<'a, 'ctx, T: ?Sized + 'ctx> WithContextLt::RaiseForLt<'a, 'ctx, &'a (&'ctx (),)> - for BoxedStatic<T> -{ - type HigherRanked = DynBoxedStatic<T>; +bijective_higher_ranked_type! { + /// Higher ranked type for [`BoxedStatic`]. + pub for['ctx] type DynBoxedStatic[][T]: WithContextLt['ctx][] + for<'a> + (BoxedStatic<T>) + where { + T: ?Sized + 'ctx, + } } #[cfg(feature = "alloc")] |