Esc

free_toml_value

procedureextensionsince 0.36.1Source
  • macOS: free_toml_value works on macOS
  • Linux: free_toml_value works on Linux
  • Windows: free_toml_value works on Windows
  • Wasm: free_toml_value works on Wasm

Releases what a decode allocated, for a decoded struct: strings, arrays, pointers (and what they point to) and nested structs. Fields still holding their declared default are left alone, so name := "guest" is safe. The fields are reset; a second call does nothing.

Signature

free_toml_value :: (value: *$T)
Example↗
Host :: struct {
    name: string;
}

host, _ := from_toml(Host, "name = 'a'\n");
free_toml_value(*host);
assert(host.name.count == 0);

See also