var.as
T as(T)() const @safeConvert the stored value to type T.
Conversion rules:
- If the current type is
Type.NULL, this returnsT.init. - Scalars and strings convert via
std.conv.to. - If the current type is
Type.ARRAYandTisvar[],
a copy of the underlying array is returned. If T is string, this returns the textual representation from toString().
- If the current type is
Type.OBJECT(map) andTisvar[string],
a copy of the underlying map is returned. If T is string, this returns the textual representation from toString().
- For other combinations, behavior is currently
T.init.