pub trait Upcast: Sized {
type Higher;
// Required methods
fn upcast(self) -> Self::Higher;
fn downcast(inp: Self::Higher) -> Option<Self>;
}
Expand description
Performs upcasting to type with higher (and/or lower) limits.
i.e. casts u8 to u16
Required Associated Types§
Required Methods§
Sourcefn downcast(inp: Self::Higher) -> Option<Self>
fn downcast(inp: Self::Higher) -> Option<Self>
Attempts to cast down to lower from higher. Returns Option::None
if inp exceeds the
limits of Self.
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.