Function metatype::try_type_coerce[][src]

pub fn try_type_coerce<A, B>(a: A) -> Option<B>
Expand description

Convert from one type parameter to another, where they are the same type. Returns None if the types differ.

In almost all circumstances this isn’t needed, but it can be very useful in cases like rust-lang/rust#50318.