[][src]Function rendy::util::identical_cast

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

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);
}