diff options
author | HampusM <hampus@hampusmat.com> | 2022-07-24 11:02:33 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-07-24 11:02:33 +0200 |
commit | 613cd7129439d04f576325bcf55d276847efb136 (patch) | |
tree | 3dc1c300b1b492fca1aeaa7410969347b54737fc /src/libs/intertrait/cast_rc.rs | |
parent | bd70e925f773de338c93cfd2ff720ef11aaa0848 (diff) |
refactor: clean up intertrait lib
Diffstat (limited to 'src/libs/intertrait/cast_rc.rs')
-rw-r--r-- | src/libs/intertrait/cast_rc.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libs/intertrait/cast_rc.rs b/src/libs/intertrait/cast_rc.rs index 79d8d60..5901b5e 100644 --- a/src/libs/intertrait/cast_rc.rs +++ b/src/libs/intertrait/cast_rc.rs @@ -17,16 +17,16 @@ use crate::libs::intertrait::{caster, CastFrom}; pub trait CastRc { - /// Casts an `Rc` for this trait into that for type `T`. - fn cast<T: ?Sized + 'static>(self: Rc<Self>) -> Result<Rc<T>, Rc<Self>>; + /// Casts an `Rc` for this trait into that for `Trait`. + fn cast<Trait: ?Sized + 'static>(self: Rc<Self>) -> Result<Rc<Trait>, Rc<Self>>; } /// A blanket implementation of `CastRc` for traits extending `CastFrom`. -impl<S: ?Sized + CastFrom> CastRc for S +impl<CastableFrom: ?Sized + CastFrom> CastRc for CastableFrom { - fn cast<T: ?Sized + 'static>(self: Rc<Self>) -> Result<Rc<T>, Rc<Self>> + fn cast<Trait: ?Sized + 'static>(self: Rc<Self>) -> Result<Rc<Trait>, Rc<Self>> { - match caster::<T>((*self).type_id()) { + match caster::<Trait>((*self).type_id()) { Some(caster) => Ok((caster.cast_rc)(self.rc_any())), None => Err(self), } |