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. IfTisstring, this returns the textual representation fromtoString(). - If the current type is
Type.OBJECT(map) andTisvar[string], a copy of the underlying map is returned. IfTisstring, this returns the textual representation fromtoString(). - For other combinations, behavior is currently
T.init.