multiversx_sc_codec

Trait 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§

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl TryStaticCast for i32

Source§

impl TryStaticCast for ()

Implementors§