pub fn downcast_as<I: 'static, O: 'static>(input: I) -> Option<O> {
    trait DowncastAs<O> {
        fn downcast_as(self) -> Option<O>;
    }

    impl<I: 'static, O: 'static> DowncastAs<O> for I {
        default fn downcast_as(self) -> Option<O> {
            None
        }
    }

    impl<T: 'static> DowncastAs<T> for T {
        default fn downcast_as(self) -> Option<T> {
            Some(self)
        }
    }

    DowncastAs::<O>::downcast_as(input)
}
/// Returns the exact input if both given types `I` and `O` are the same type,
/// `None` otherwise.
///
/// This function makes only sense in generic contexts where you want to get a
/// specific type from a generic one.
///
/// The types are required to be `'static` because comparing lifetimes for
/// equality is tricky. In particular because this function is implemented
/// using specialization which has known soundness holes regarding lifetimes.


This function makes only sense in generic contexts where you want to get a
specific type from a generic one.

The types are required to be `'static` because comparing lifetimes for
equality is tricky. In particular because this function is implemented
using specialization which has known soundness holes regarding lifetimes.
This function makes only sense in generic contexts where you want to get a specific type from a generic one . The types are required to be ` ' static ` because comparing lifetimes for equality is tricky . In particular because this function is implemented using specialization which has known soundness holes regarding lifetimes .
pub fn downcast_as<I: 'static, O: 'static>(input: I) -> Option<O> {
    trait DowncastAs<O> {
        fn downcast_as(self) -> Option<O>;
    }
    impl<I: 'static, O: 'static> DowncastAs<O> for I {
        default fn downcast_as(self) -> Option<O> {
            None
        }
    }
    impl<T: 'static> DowncastAs<T> for T {
        default fn downcast_as(self) -> Option<T> {
            Some(self)
        }
    }
    DowncastAs::<O>::downcast_as(input)
}
pub fn downcast_as < I : ' static , O : ' static > ( input : I ) -> Option < O > { trait DowncastAs < O > { fn downcast_as ( self ) -> Option < O > ; } impl < I : ' static , O : ' static > DowncastAs < O > for I { default fn downcast_as ( self ) -> Option < O > { None } } impl < T : ' static > DowncastAs < T > for T { default fn downcast_as ( self ) -> Option < T > { Some ( self ) } } DowncastAs :: < O > :: downcast_as ( input ) }
Returns the exact input if both given types `I` and `O` are the same type,
`None` otherwise.
Returns the exact input if both given types ` I ` and ` O ` are the same type ` None ` otherwise .
input
I
input
I