pub fn create_variant_from<T: CreateVariantFrom<U, Marker>, Marker, U>(
    value: U
) -> T
Expand description

This function allows the user to call a type’s create_variant_from trait method without explicitly naming the type:

Example:

use variant_access_traits::*;
use variant_access_derive::*;

#[(VariantAccessDerive)]
enum HorribleComputerGeneratedEnumName {
    AwfulComputerGeneratedField1(f64),
    AwfulComputerGeneratedField2(bool)
}

struct LovelyStruct {
    lovely_field_name: HorribleComputerGeneratedEnumName
}

fn main() {
    let lovely = LovelyStruct{lovely_field_name: create_variant_from(3.0)};
    // let lovely = LovelyStruct{ lovely_field_name: create_variant_from("")}; //will not compile
}