[][src]Function traitcast::cast_box

pub fn cast_box<From: ?Sized, To: ?Sized>(
    x: Box<From>
) -> Result<Box<To>, Box<dyn Any>> where
    From: TraitcastFrom,
    To: 'static, 

Tries to cast the given pointer to a dynamic trait object. This will always return Err if the implementation of the target trait, for the concrete type of x, has not been registered via traitcast!.