[−][src]Type Definition structural::field::GetVariantFieldType
type GetVariantFieldType<This, Variant, Field> = <This as FieldType<VariantField<Variant, Field>>>::Ty;
Gets the type of a variant field,
most useful when the variant and field TStr
s are passed separately.
The Variant
and Field
type parameters are expected to be TStr
.
Example: GetVariantFieldType<This, TS!(Foo), TS!(0)>
If you want to write the type parameter as FP!(::Foo.bar)
,
then you can use GetFieldType
instead.
Example
use structural::{StructuralExt,TS,fp}; use structural::field::GetVariantFieldType; use structural::for_examples::Variants; let this = Variants::Foo(8,13); let value: u32= this.into_field(fp!(::Foo.0)).unwrap(); let value: GetVariantFieldType<Variants, TS!(Foo), TS!(0)>= value; assert_eq!( value, 8_u32 );