Diffstat (limited to 'src/any/ref_any_unsized.rs')
-rw-r--r--src/any/ref_any_unsized.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/any/ref_any_unsized.rs b/src/any/ref_any_unsized.rs
index 0772e42..6e4cfdc 100644
--- a/src/any/ref_any_unsized.rs
+++ b/src/any/ref_any_unsized.rs
@@ -1,4 +1,4 @@
-use crate::hkt::CovariantLt;
+use crate::hkt::ImpliedBound;
use super::{erased::Erased, type_name, WithLtTypeId};
@@ -8,10 +8,10 @@ use super::{erased::Erased, type_name, WithLtTypeId};
/// This type exists to get a borrow of an arbitrary trait object out of a object safe method.
/// However, it is not limited to storing borrows of trait objects. It can be
/// used to store a borrow to any type including sized ones.
-pub struct RefAnyUnsized<'a, 'lt, 'ctx> {
+pub struct RefAnyUnsized<'r, 'lt> {
/// As shown in the table at https://doc.rust-lang.org/nomicon/subtyping.html#variance
/// borrows are covariant over their lifetime, so we are also.
- _a: CovariantLt<'a>,
+ _b: ImpliedBound<'r, 'lt>,
/// The type erased borrow.
///
@@ -25,24 +25,24 @@ pub struct RefAnyUnsized<'a, 'lt, 'ctx> {
///
/// We use a function here to reduce the size down to one usize.
/// This makes a RefAnyUnsized only 3 usize wide.
- type_name_id: fn() -> WithLtTypeId<'lt, 'ctx>,
+ type_name_id: fn() -> WithLtTypeId<'lt>,
}
-impl<'a, 'lt: 'a, 'ctx: 'lt> RefAnyUnsized<'a, 'lt, 'ctx> {
+impl<'r, 'lt> RefAnyUnsized<'r, 'lt> {
/// Create from a borrow.
- pub fn new<T: ?Sized + type_name::WithLt<'lt, 'ctx>>(borrow: &'a T) -> Self {
+ pub fn new<T: ?Sized + type_name::WithLt<'r, 'lt>>(borrow: &'r T) -> Self {
Self {
- _a: CovariantLt::NEW,
- borrow: Erased::new::<&'a T>(borrow),
+ _b: ImpliedBound::NEW,
+ borrow: Erased::new::<&'r T>(borrow),
type_name_id: || WithLtTypeId::of::<T>(),
}
}
/// Downcast the type erased value back to its original type.
- pub fn downcast<T: ?Sized + type_name::WithLt<'lt, 'ctx>>(self) -> Result<&'a T, Self> {
+ pub fn downcast<T: ?Sized + type_name::WithLt<'r, 'lt>>(self) -> Result<&'r T, Self> {
if (self.type_name_id)() == WithLtTypeId::of::<T>() {
#[allow(unsafe_code)]
- Ok(unsafe { self.borrow.into_inner::<&'a T>() })
+ Ok(unsafe { self.borrow.into_inner::<&'r T>() })
} else {
Err(self)
}