Skip to main content

gen_struct_default_impl

Function gen_struct_default_impl 

Source
pub fn gen_struct_default_impl(typ: &TypeDef, name_prefix: &str) -> String
Expand description

Generate a Default impl for a non-opaque binding struct with has_default. All fields use their type’s Default::default(). Optional fields use None instead of Default::default(). This enables the struct to be used with unwrap_or_default() in config constructors.