Trait VariantExt

Source
pub trait VariantExt<B>: Sized {
    const VARTYPE: u32;

    // Required methods
    fn from_variant(var: Ptr<VARIANT>) -> Result<Self, FromVariantError>;
    fn into_variant(value: Self) -> Result<Ptr<VARIANT>, IntoVariantError>;
}
Expand description

Trait implemented to convert the type into a VARIANT. Do not implement this yourself without care.

Required Associated Constants§

Source

const VARTYPE: u32

VARTYPE constant value for the type

Required Methods§

Source

fn from_variant(var: Ptr<VARIANT>) -> Result<Self, FromVariantError>

Call this associated function on a Ptr<VARIANT> to obtain a value T

Source

fn into_variant(value: Self) -> Result<Ptr<VARIANT>, IntoVariantError>

Convert a value of type T into a Ptr<VARIANT>

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<OutTy, InTy> VariantExt<InTy> for OutTy
where OutTy: TryConvert<InTy, FromVariantError> + VariantAccess<Field = InTy>, InTy: TryConvert<OutTy, IntoVariantError>,

Blanket implementation where TryConvert implementations exist between OutTy<==>InTy and a private trait is implemented on OutTy.

Source§

const VARTYPE: u32 = OutTy::VTYPE