CastFrom

Trait CastFrom 

Source
pub trait CastFrom<T> {
    // Required method
    fn cast(value: T) -> Self;
}
Expand description

Cast between primitive types such as f32 and f64.

Required Methods§

Source

fn cast(value: T) -> Self

Casts the specified source value to the destination primitive type by using the as expression.

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.

Implementations on Foreign Types§

Source§

impl CastFrom<f32> for f32

Source§

fn cast(value: f32) -> f32

Source§

impl CastFrom<f32> for f64

Source§

fn cast(value: f32) -> f64

Source§

impl CastFrom<f64> for f32

Source§

fn cast(value: f64) -> f32

Source§

impl CastFrom<f64> for f64

Source§

fn cast(value: f64) -> f64

Implementors§