Trait safecast::CastFrom

source ·
pub trait CastFrom<T> {
    fn cast_from(value: T) -> Self;
}
Expand description

Trait for defining a cast operation from some source type T. Analogous to From. The inverse of CastInto. Prefer implementing CastFrom over CastInto because implementing CastFrom automatically provides an implementation of CastInto.

Required Methods§

Cast an instance of T into an instance of Self.

Implementors§