//! Wrapper types that impl [`TypeName`] when their generic type `T` is `'static`. use effectful::SendSync; use crate::hkt::Marker; use super::*; /// Named `T` where `T: 'static`. #[derive(PartialEq, Clone, Copy, Debug, SendSync)] #[repr(transparent)] pub struct OwnedStatic(pub T); impl<'lt, 'ctx, T: ?Sized + 'static> type_name::Lower<'lt, 'ctx, &'lt &'ctx ()> for OwnedStatic { type Lowered = OwnedStatic; } impl<'lt, 'ctx, T: ?Sized + 'static> type_name::Raise<'lt, 'ctx, &'lt &'ctx ()> for OwnedStatic { type Raised = OwnedStatic; } /// Named `&'ctx T` where` T: 'static`. #[derive(PartialEq, Clone, Copy, Debug, SendSync)] #[repr(transparent)] pub struct BorrowedStatic<'ctx, T: ?Sized>(pub &'ctx T); const _: () = { pub struct BorrowedStaticHrt(Marker); impl<'lt, 'ctx, T: ?Sized + 'static> type_name::Lower<'lt, 'ctx, &'lt &'ctx ()> for BorrowedStaticHrt { type Lowered = BorrowedStatic<'ctx, T>; } impl<'lt, 'ctx, T: ?Sized + 'static> type_name::Raise<'lt, 'ctx, &'lt &'ctx ()> for BorrowedStatic<'ctx, T> { type Raised = BorrowedStaticHrt; } }; /// Named `&'lt T` where` T: 'static`. #[derive(PartialEq, Clone, Copy, Debug, SendSync)] #[repr(transparent)] pub struct TempBorrowedStatic<'lt, T: ?Sized>(pub &'lt T); const _: () = { pub struct TempBorrowedStaticHrt(Marker); impl<'lt, 'ctx, T: ?Sized + 'static> type_name::Lower<'lt, 'ctx, &'lt &'ctx ()> for TempBorrowedStaticHrt { type Lowered = TempBorrowedStatic<'lt, T>; } impl<'lt, 'ctx, T: ?Sized + 'static> type_name::Raise<'lt, 'ctx, &'lt &'ctx ()> for TempBorrowedStatic<'lt, T> { type Raised = TempBorrowedStaticHrt; } }; /// Named `&'ctx mut T` where` T: 'static`. #[derive(PartialEq, Debug, SendSync)] #[repr(transparent)] pub struct BorrowedMutStatic<'ctx, T: ?Sized>(pub &'ctx mut T); const _: () = { pub struct BorrowedMutStaticHrt(Marker); impl<'lt, 'ctx, T: ?Sized + 'static> type_name::Lower<'lt, 'ctx, &'lt &'ctx ()> for BorrowedMutStaticHrt { type Lowered = BorrowedMutStatic<'ctx, T>; } impl<'lt, 'ctx, T: ?Sized + 'static> type_name::Raise<'lt, 'ctx, &'lt &'ctx ()> for BorrowedMutStatic<'ctx, T> { type Raised = BorrowedMutStaticHrt; } }; /// Named `&'lt mut T` where` T: 'static`. #[derive(PartialEq, Debug, SendSync)] #[repr(transparent)] pub struct TempBorrowedMutStatic<'lt, T: ?Sized>(pub &'lt mut T); const _: () = { pub struct TempBorrowedMutStaticHrt(Marker); impl<'lt, 'ctx, T: ?Sized + 'static> type_name::Lower<'lt, 'ctx, &'lt &'ctx ()> for TempBorrowedMutStaticHrt { type Lowered = TempBorrowedMutStatic<'lt, T>; } impl<'lt, 'ctx, T: ?Sized + 'static> type_name::Raise<'lt, 'ctx, &'lt &'ctx ()> for TempBorrowedMutStatic<'lt, T> { type Raised = TempBorrowedMutStaticHrt; } };