Cast

Trait Cast 

Source
pub trait Cast
where Self: Sized + ToPrimitive + Copy,
{ // Required method fn cast<Target>(self) -> Result<Target, CastError<Self, Target>> where Target: NumCast; }

Required Methods§

Source

fn cast<Target>(self) -> Result<Target, CastError<Self, Target>>
where Target: NumCast,

Checked cast of self to Target.

§Errors

When self can not be casted to Target.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<Src> Cast for Src
where Self: Sized + ToPrimitive + Copy,