Trait CastFrom

Source
pub trait CastFrom<T>: Sized {
    // Required method
    unsafe fn cast_from(value: T) -> Self;
}
Expand description

Performs some of the conversions that are available implicitly in C++.

CastInto is automatically implemented for all CastFrom conversions, similar to From and Into traits from std.

Required Methods§

Source

unsafe fn cast_from(value: T) -> Self

Performs the conversion.

§Safety

This operation is safe as long as value is valid.

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§

Source§

impl<'a, T, U> CastFrom<&'a CppBox<U>> for Ptr<T>
where U: StaticUpcast<T> + CppDeletable,

Source§

impl<'a, T, U> CastFrom<&'a CppBox<U>> for Ref<T>
where U: StaticUpcast<T> + CppDeletable,

Source§

impl<T> CastFrom<NullPtr> for Ptr<T>

Source§

impl<T, U> CastFrom<*const U> for Ptr<T>
where U: StaticUpcast<T>,

Source§

impl<T, U> CastFrom<*mut U> for Ptr<T>
where U: StaticUpcast<T>,

Source§

impl<T, U> CastFrom<Ptr<U>> for Ptr<T>
where U: StaticUpcast<T>,

Source§

impl<T, U> CastFrom<Ref<U>> for Ptr<T>
where U: StaticUpcast<T>,

Source§

impl<T, U> CastFrom<Ref<U>> for Ref<T>
where U: StaticUpcast<T>,