Skip to main content

emit_option_read_expr

Function emit_option_read_expr 

Source
fn emit_option_read_expr(
    reader_var: &str,
    field: &FieldDef,
    opt_struct: &StructDef,
    inner_type_name: &str,
    schema: &ParsedSchema,
) -> String
Expand description

Generate an inline expression that reads an Option* wrapper struct pointer.

Returns T | undefined: reads the struct pointer, checks the discriminant, and returns the inner value if discriminant == 1 (some), else undefined.