Trait CastFrom

Source
pub trait CastFrom<T: Copy>: Copy {
    // Required methods
    fn cast_from(value: T) -> Self;
    fn cast_from_lossy(value: T) -> Self;
}

Required Methods§

Source

fn cast_from(value: T) -> Self

By default, casts should be exact.

Source

fn cast_from_lossy(value: T) -> Self

Call for casts that are expected to truncate.

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§