Marmos
v juptune
v asn1
v lang
v ast
v Classes
v Enums
v ir
v parser
v Enums
v Structs
v core
v crypto
v keyexchange
v memory
v data
v alphabet
v buffer
v json
v builder
v parser
v Enums
v Structs
v serialise
v Structs
v Templates
v pem
v Enums
v Structs

Functions JsonParser.Token.asInt

1
2
3
4
5
6
7
module juptune.data.json.parser;

Result asInt(
    IntegralT
)(
    IntegralT number
);

Documentation

Retrieves the value of this integer token, and attempts to coerce it into the given IntegralT.

Notes

This function only works on integer tokens. Floats must either use asFloat(TODO) or asNumber(TODO).

The value of numberis undefined if this function returns an error.

Params

Throws

JsonParserError.numberCannotBeRepresentedif the number was too big or too small to fit into any native integer type.

JsonParserError.numberCannotBeRepresentedif the number stored can be represented by a native integer type, but not by the specified IntegralT.

JsonParserError.numberIsNegativeif IntegralTis unsigned, but the number stored is negative.

Returns

An errorful Resultif something went wrong.