Diffstat (limited to 'src/any.rs')
-rw-r--r--src/any.rs34
1 files changed, 14 insertions, 20 deletions
diff --git a/src/any.rs b/src/any.rs
index 86c566a..cc6a0e5 100644
--- a/src/any.rs
+++ b/src/any.rs
@@ -16,33 +16,27 @@ pub use ref_any_unsized::*;
pub use static_wrapper::*;
pub use type_name_id::*;
-pub trait AnyTrait<'lt, 'ctx: 'lt>: 'lt {
- fn upcast_by_id<'a>(
- &'a self,
- id: WithLtTypeId<'lt, 'ctx>,
- ) -> Option<RefAnyUnsized<'a, 'lt, 'ctx>>
- where
- 'lt: 'a
- {
+pub trait AnyTrait<'lt> {
+ fn upcast_by_id(
+ &self,
+ id: WithLtTypeId<'lt>,
+ ) -> Option<RefAnyUnsized<'_, 'lt>> {
let _id = id;
None
}
- fn upcast_by_id_mut<'a>(
- &'a mut self,
- id: WithLtTypeId<'lt, 'ctx>,
- ) -> Option<MutAnyUnsized<'a, 'lt, 'ctx>>
- where
- 'lt: 'a
- {
+ fn upcast_by_id_mut(
+ &mut self,
+ id: WithLtTypeId<'lt>,
+ ) -> Option<MutAnyUnsized<'_, 'lt>> {
let _id = id;
None
}
}
-impl<'lt, 'ctx: 'lt> dyn AnyTrait<'lt, 'ctx> + 'lt {
+impl<'u, 'lt: 'u> dyn AnyTrait<'lt> + 'u {
#[track_caller]
- pub fn upcast<'a, T: ?Sized + type_name::WithLt<'lt, 'ctx>>(&'a self) -> Option<&'a T> {
+ pub fn upcast<'r, T: ?Sized + type_name::WithLt<'r, 'lt>>(&'r self) -> Option<&'r T> {
self.upcast_by_id(WithLtTypeId::of::<T>())
.map(|value| match value.downcast::<T>() {
Ok(value) => value,
@@ -51,9 +45,9 @@ impl<'lt, 'ctx: 'lt> dyn AnyTrait<'lt, 'ctx> + 'lt {
}
#[track_caller]
- pub fn upcast_mut<'a, T: ?Sized + type_name::WithLt<'lt, 'ctx>>(
- &'a mut self,
- ) -> Option<&'a mut T> {
+ pub fn upcast_mut<'r, T: ?Sized + type_name::WithLt<'r, 'lt>>(
+ &'r mut self,
+ ) -> Option<&'r mut T> {
self.upcast_by_id_mut(WithLtTypeId::of::<T>())
.map(|value| match value.downcast::<T>() {
Ok(value) => value,