Trait multiversx_sc_codec::TryStaticCast
source · pub trait TryStaticCast: Sized + 'static {
// Provided methods
fn type_eq<U: TryStaticCast>() -> bool { ... }
fn try_cast<U: TryStaticCast>(self) -> Option<U> { ... }
fn try_cast_ref<U: TryStaticCast>(&self) -> Option<&U> { ... }
}
Expand description
Use to transfer objects from one generic type to another, without the compiler being able to determine whether or not the two types are the same. The cast is statically dispatched.
Provided Methods§
fn type_eq<U: TryStaticCast>() -> bool
fn try_cast<U: TryStaticCast>(self) -> Option<U>
fn try_cast_ref<U: TryStaticCast>(&self) -> Option<&U>
Object Safety§
This trait is not object safe.