Diffstat (limited to 'src/any.rs')
| -rw-r--r-- | src/any.rs | 70 |
1 files changed, 38 insertions, 32 deletions
@@ -3,7 +3,7 @@ //! The `AnyTrait` trait provides dynamic upcasting to trait objects. pub mod indirect; -mod static_wrapper; +// mod static_wrapper; mod type_name_id; use crate::{ @@ -12,7 +12,7 @@ use crate::{ }; use core::marker::PhantomData; -pub use static_wrapper::*; +// pub use static_wrapper::*; pub use type_name_id::*; #[cfg(all(feature = "alloc", not(feature = "std")))] @@ -46,44 +46,50 @@ higher_ranked_type! { where { T: ?Sized + TypeName::LowerType<'a, 'ctx> }; - } -} - -pub struct MutHrt<T: ?Sized>(Marker<T>); - -higher_ranked_type! { - impl TypeName { - impl['a, 'ctx, T] type T['a, 'ctx] for MutHrt<T> = - &'a mut TypeName::T<'a, 'ctx, T> - where { - T: ?Sized + TypeName::LowerForLt<'a, 'ctx, TypeName::Bound<'a, 'ctx>>, - TypeName::T<'a, 'ctx, T>: 'a - }; - impl['a, 'ctx, T] type HigherRanked['a, 'ctx] for &'a mut T = - MutHrt<TypeName::HigherRanked<'a, 'ctx, T>> + impl['a, 'ctx, T] type HigherRankedAll['a, 'ctx] for &'a T = + RefHrt<TypeName::HigherRankedAll<'a, 'ctx, T>> where { T: ?Sized + TypeName::LowerType<'a, 'ctx> }; } } -#[cfg(feature = "alloc")] -higher_ranked_type! { - impl TypeName { - impl['a, 'ctx, T] type T['a, 'ctx] for Box<T> = - Box<TypeName::T<'a, 'ctx, T>> - where { - T: ?Sized + TypeName::LowerForLt<'a, 'ctx, TypeName::Bound<'a, 'ctx>>, - }; +pub struct MutHrt<T: ?Sized>(Marker<T>); - impl['a, 'ctx, T] type HigherRanked['a, 'ctx] for Box<T> = - Box<TypeName::HigherRanked<'a, 'ctx, T>> - where { - T: ?Sized + TypeName::LowerType<'a, 'ctx> - }; - } -} +// higher_ranked_type! { +// impl TypeName { +// impl['a, 'ctx, T] type T['a, 'ctx] for MutHrt<T> = +// &'a mut TypeName::T<'a, 'ctx, T> +// where { +// T: ?Sized + TypeName::LowerForLt<'a, 'ctx, TypeName::Bound<'a, 'ctx>>, +// TypeName::T<'a, 'ctx, T>: 'a +// }; +// +// impl['a, 'ctx, T] type HigherRanked['a, 'ctx] for &'a mut T = +// MutHrt<TypeName::HigherRanked<'a, 'ctx, T>> +// where { +// T: ?Sized + TypeName::RaiseForLt<'a, 'ctx, TypeName::Bound<'a, 'ctx>> +// }; +// } +// } + +// #[cfg(feature = "alloc")] +// higher_ranked_type! { +// impl TypeName { +// impl['a, 'ctx, T] type T['a, 'ctx] for Box<T> = +// Box<TypeName::T<'a, 'ctx, T>> +// where { +// T: ?Sized + TypeName::LowerForLt<'a, 'ctx, TypeName::Bound<'a, 'ctx>>, +// }; +// +// impl['a, 'ctx, T] type HigherRanked['a, 'ctx] for Box<T> = +// Box<TypeName::HigherRanked<'a, 'ctx, T>> +// where { +// T: ?Sized + TypeName::RaiseForLt<'a, 'ctx, TypeName::Bound<'a, 'ctx>> +// }; +// } +// } /// Dynamic trait lookup. /// |