Trait CastInto

Source
pub trait CastInto<T: Copy>: Copy {
    // Required methods
    fn cast(self) -> T;
    fn cast_lossy(self) -> T;
}
Expand description

Trait to express (possibly lossy) casting of integers

Required Methods§

Source

fn cast(self) -> T

By default, casts should be exact.

Source

fn cast_lossy(self) -> T

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§