Variant module

free_variant

procedure · 1 overloadsince 0.29.0Source

Releases the memory the live case owns, with free: strings, resizable arrays (and what their elements own), and the same inside structs and nested variants. Views ([] T) and pointers are not owned and are left alone. Then the variant is zeroed: its first case, zeroed. Only use it on payloads that came from the allocator, not string literals.

free_variant :: (v: *$V/Variant)

Releases the memory the live case owns, with free: strings, resizable arrays (and what their elements own), and the same inside structs and nested variants. Views ([] T) and pointers are not owned and are left alone. Then the variant is zeroed: its first case, zeroed. Only use it on payloads that came from the allocator, not string literals.

Parameters

v: *$V/Variant

See also