pub trait CastFrom<T> {
// Required method
fn cast_from(t: T) -> Self;
}Expand description
Like [From], but supporting target-specific casts.
[From] does not support casts which are not valid on all targets (such as
u32 to usize, which is not valid on 16-bit platforms). CastFrom, by
contrast, supports all conversions which are valid on a given target. As a
consequence, uses of CastFrom may not be portable to all targets.
Like [From], CastFrom only supports lossless casts.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".