Variant module

set

procedureextensionsince 0.29.0Source

Stores value as the live case, replacing whatever was there without releasing it (see free_variant). It is a compile-time error when T is not a case.

Example↗
#import "Extensions/Variant";

Id :: Variant(s64, string);
id: Id;
set(*id, "abc");
set(*id, cast(s64) 7);
assert(unwrap(id, s64) == 7);
set :: (v: *$V/Variant, value: $T)

Parameters

v: *$V/Variant
value: $T

See also