diff options
author | HampusM <hampus@hampusmat.com> | 2022-08-30 18:53:23 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-08-30 18:53:23 +0200 |
commit | d6f01bd571753dc2e9628418f94f66139438bcb3 (patch) | |
tree | 1ed5492d8abdeb9231d498e9ecf349c7cc1ec3d8 /src/libs/intertrait/cast/box.rs | |
parent | 080cc42bb1da09059dbc35049a7ded0649961e0c (diff) |
refactor: replace arc cast panic with an error
Diffstat (limited to 'src/libs/intertrait/cast/box.rs')
-rw-r--r-- | src/libs/intertrait/cast/box.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libs/intertrait/cast/box.rs b/src/libs/intertrait/cast/box.rs index 31f06db..c463c2f 100644 --- a/src/libs/intertrait/cast/box.rs +++ b/src/libs/intertrait/cast/box.rs @@ -13,7 +13,7 @@ use std::any::type_name; use crate::libs::intertrait::cast::error::CastError; -use crate::libs::intertrait::{caster, CastFrom}; +use crate::libs::intertrait::{get_caster, CastFrom}; pub trait CastBox { @@ -30,7 +30,7 @@ impl<CastFromSelf: ?Sized + CastFrom> CastBox for CastFromSelf self: Box<Self>, ) -> Result<Box<OtherTrait>, CastError> { - match caster::<OtherTrait>((*self).type_id()) { + match get_caster::<OtherTrait>((*self).type_id()) { Some(caster) => Ok((caster.cast_box)(self.box_any())), None => Err(CastError::CastFailed { from: type_name::<CastFromSelf>(), |