[][src]Function rendy_core::identical_cast

pub fn identical_cast<T: 'static, U: 'static>(value: T) -> U

Casts identical types. Useful in generic environment where caller knows that two types are the same but Rust is not convinced.

Panics

Panics if types are actually different.

Example

if TypeId::of::<T>() == TypeId::of::<u32>() {
    let value: T = identical_cast(42u32);
}