Trait safecast::CastFrom

source ·
pub trait CastFrom<T> {
    // Required method
    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§

source

fn cast_from(value: T) -> Self

Cast an instance of T into an instance of Self.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<F, T: From<F>> CastFrom<F> for T