Parsing integers, booleans and characters v0.1.0
ParseUint8
pub func ParseUint8(str: char8[..]) -> uint8 ! ParseError
pub func ParseUint8(str: StringView) -> uint8 ! ParseError
Parses a uint8: an optional +, an optional base prefix, and digits.
Reports Overflow for a value the width cannot hold, InvalidCharacter at the first byte that is not
part of the grammar — a - included, since no unsigned value is negative.
| Overload | Summary |
|---|---|
pub func ParseUint8(str: char8[..]) -> uint8 ! ParseError | Parses a uint8: an optional +, an optional base prefix, and digits. |
pub func ParseUint8(str: StringView) -> uint8 ! ParseError | The same grammar for a view, which is what a caller holding text has. |
Parameters
| Name | Type | Description |
|---|---|---|
str | char8[..] / StringView | the text to parse |
Returns: the value, or the failure and the byte offset it was found at
ParseInt8
pub func ParseInt8(str: char8[..]) -> int8 ! ParseError
pub func ParseInt8(str: StringView) -> int8 ! ParseError
Parses an int8: an optional sign, an optional base prefix, and digits.
The negative bound is one larger than the positive one, because the most negative value has no positive
counterpart: the value one past the largest positive fits only with its sign.
| Overload | Summary |
|---|---|
pub func ParseInt8(str: char8[..]) -> int8 ! ParseError | Parses an int8: an optional sign, an optional base prefix, and digits. |
pub func ParseInt8(str: StringView) -> int8 ! ParseError | The same grammar for a view, which is what a caller holding text has. |
Parameters
| Name | Type | Description |
|---|---|---|
str | char8[..] / StringView | the text to parse |
Returns: the value, or the failure and the byte offset it was found at
ParseUint16
pub func ParseUint16(str: char8[..]) -> uint16 ! ParseError
pub func ParseUint16(str: StringView) -> uint16 ! ParseError
Parses a uint16: an optional +, an optional base prefix, and digits.
Reports Overflow for a value the width cannot hold, InvalidCharacter at the first byte that is not
part of the grammar — a - included, since no unsigned value is negative.
| Overload | Summary |
|---|---|
pub func ParseUint16(str: char8[..]) -> uint16 ! ParseError | Parses a uint16: an optional +, an optional base prefix, and digits. |
pub func ParseUint16(str: StringView) -> uint16 ! ParseError | The same grammar for a view, which is what a caller holding text has. |
Parameters
| Name | Type | Description |
|---|---|---|
str | char8[..] / StringView | the text to parse |
Returns: the value, or the failure and the byte offset it was found at
ParseInt16
pub func ParseInt16(str: char8[..]) -> int16 ! ParseError
pub func ParseInt16(str: StringView) -> int16 ! ParseError
Parses an int16: an optional sign, an optional base prefix, and digits.
The negative bound is one larger than the positive one, because the most negative value has no positive
counterpart: the value one past the largest positive fits only with its sign.
| Overload | Summary |
|---|---|
pub func ParseInt16(str: char8[..]) -> int16 ! ParseError | Parses an int16: an optional sign, an optional base prefix, and digits. |
pub func ParseInt16(str: StringView) -> int16 ! ParseError | The same grammar for a view, which is what a caller holding text has. |
Parameters
| Name | Type | Description |
|---|---|---|
str | char8[..] / StringView | the text to parse |
Returns: the value, or the failure and the byte offset it was found at
ParseUint32
pub func ParseUint32(str: char8[..]) -> uint32 ! ParseError
pub func ParseUint32(str: StringView) -> uint32 ! ParseError
Parses a uint32: an optional +, an optional base prefix, and digits.
Reports Overflow for a value the width cannot hold, InvalidCharacter at the first byte that is not
part of the grammar — a - included, since no unsigned value is negative.
| Overload | Summary |
|---|---|
pub func ParseUint32(str: char8[..]) -> uint32 ! ParseError | Parses a uint32: an optional +, an optional base prefix, and digits. |
pub func ParseUint32(str: StringView) -> uint32 ! ParseError | The same grammar for a view, which is what a caller holding text has. |
Parameters
| Name | Type | Description |
|---|---|---|
str | char8[..] / StringView | the text to parse |
Returns: the value, or the failure and the byte offset it was found at
ParseInt32
pub func ParseInt32(str: char8[..]) -> int32 ! ParseError
pub func ParseInt32(str: StringView) -> int32 ! ParseError
Parses an int32: an optional sign, an optional base prefix, and digits.
The negative bound is one larger than the positive one, because the most negative value has no positive
counterpart: the value one past the largest positive fits only with its sign.
| Overload | Summary |
|---|---|
pub func ParseInt32(str: char8[..]) -> int32 ! ParseError | Parses an int32: an optional sign, an optional base prefix, and digits. |
pub func ParseInt32(str: StringView) -> int32 ! ParseError | The same grammar for a view, which is what a caller holding text has. |
Parameters
| Name | Type | Description |
|---|---|---|
str | char8[..] / StringView | the text to parse |
Returns: the value, or the failure and the byte offset it was found at
ParseUint64
pub func ParseUint64(str: char8[..]) -> uint64 ! ParseError
pub func ParseUint64(str: StringView) -> uint64 ! ParseError
Parses a uint64: an optional +, an optional base prefix, and digits.
Reports Overflow for a value the width cannot hold, InvalidCharacter at the first byte that is not
part of the grammar — a - included, since no unsigned value is negative.
| Overload | Summary |
|---|---|
pub func ParseUint64(str: char8[..]) -> uint64 ! ParseError | Parses a uint64: an optional +, an optional base prefix, and digits. |
pub func ParseUint64(str: StringView) -> uint64 ! ParseError | The same grammar for a view, which is what a caller holding text has. |
Parameters
| Name | Type | Description |
|---|---|---|
str | char8[..] / StringView | the text to parse |
Returns: the value, or the failure and the byte offset it was found at
ParseInt64
pub func ParseInt64(str: char8[..]) -> int64 ! ParseError
pub func ParseInt64(str: StringView) -> int64 ! ParseError
Parses an int64: an optional sign, an optional base prefix, and digits.
The negative bound is one larger than the positive one, because the most negative value has no positive
counterpart: the value one past the largest positive fits only with its sign.
| Overload | Summary |
|---|---|
pub func ParseInt64(str: char8[..]) -> int64 ! ParseError | Parses an int64: an optional sign, an optional base prefix, and digits. |
pub func ParseInt64(str: StringView) -> int64 ! ParseError | The same grammar for a view, which is what a caller holding text has. |
Parameters
| Name | Type | Description |
|---|---|---|
str | char8[..] / StringView | the text to parse |
Returns: the value, or the failure and the byte offset it was found at
ParseUint128
pub func ParseUint128(str: char8[..]) -> uint128 ! ParseError
pub func ParseUint128(str: StringView) -> uint128 ! ParseError
Parses a uint128: an optional +, an optional base prefix, and digits.
Reports Overflow for a value the width cannot hold, InvalidCharacter at the first byte that is not
part of the grammar — a - included, since no unsigned value is negative.
| Overload | Summary |
|---|---|
pub func ParseUint128(str: char8[..]) -> uint128 ! ParseError | Parses a uint128: an optional +, an optional base prefix, and digits. |
pub func ParseUint128(str: StringView) -> uint128 ! ParseError | The same grammar for a view, which is what a caller holding text has. |
Parameters
| Name | Type | Description |
|---|---|---|
str | char8[..] / StringView | the text to parse |
Returns: the value, or the failure and the byte offset it was found at
ParseInt128
pub func ParseInt128(str: char8[..]) -> int128 ! ParseError
pub func ParseInt128(str: StringView) -> int128 ! ParseError
Parses an int128: an optional sign, an optional base prefix, and digits.
The negative bound is one larger than the positive one, because the most negative value has no positive
counterpart: the value one past the largest positive fits only with its sign.
| Overload | Summary |
|---|---|
pub func ParseInt128(str: char8[..]) -> int128 ! ParseError | Parses an int128: an optional sign, an optional base prefix, and digits. |
pub func ParseInt128(str: StringView) -> int128 ! ParseError | The same grammar for a view, which is what a caller holding text has. |
Parameters
| Name | Type | Description |
|---|---|---|
str | char8[..] / StringView | the text to parse |
Returns: the value, or the failure and the byte offset it was found at
ParseUint256
pub func ParseUint256(str: char8[..]) -> uint256 ! ParseError
pub func ParseUint256(str: StringView) -> uint256 ! ParseError
Parses a uint256: an optional +, an optional base prefix, and digits.
Reports Overflow for a value the width cannot hold, InvalidCharacter at the first byte that is not
part of the grammar — a - included, since no unsigned value is negative.
| Overload | Summary |
|---|---|
pub func ParseUint256(str: char8[..]) -> uint256 ! ParseError | Parses a uint256: an optional +, an optional base prefix, and digits. |
pub func ParseUint256(str: StringView) -> uint256 ! ParseError | The same grammar for a view, which is what a caller holding text has. |
Parameters
| Name | Type | Description |
|---|---|---|
str | char8[..] / StringView | the text to parse |
Returns: the value, or the failure and the byte offset it was found at
ParseInt256
pub func ParseInt256(str: char8[..]) -> int256 ! ParseError
pub func ParseInt256(str: StringView) -> int256 ! ParseError
Parses an int256: an optional sign, an optional base prefix, and digits.
The negative bound is one larger than the positive one, because the most negative value has no positive
counterpart: the value one past the largest positive fits only with its sign.
| Overload | Summary |
|---|---|
pub func ParseInt256(str: char8[..]) -> int256 ! ParseError | Parses an int256: an optional sign, an optional base prefix, and digits. |
pub func ParseInt256(str: StringView) -> int256 ! ParseError | The same grammar for a view, which is what a caller holding text has. |
Parameters
| Name | Type | Description |
|---|---|---|
str | char8[..] / StringView | the text to parse |
Returns: the value, or the failure and the byte offset it was found at
ParseUint512
pub func ParseUint512(str: char8[..]) -> uint512 ! ParseError
pub func ParseUint512(str: StringView) -> uint512 ! ParseError
Parses a uint512: an optional +, an optional base prefix, and digits.
Reports Overflow for a value the width cannot hold, InvalidCharacter at the first byte that is not
part of the grammar — a - included, since no unsigned value is negative.
| Overload | Summary |
|---|---|
pub func ParseUint512(str: char8[..]) -> uint512 ! ParseError | Parses a uint512: an optional +, an optional base prefix, and digits. |
pub func ParseUint512(str: StringView) -> uint512 ! ParseError | The same grammar for a view, which is what a caller holding text has. |
Parameters
| Name | Type | Description |
|---|---|---|
str | char8[..] / StringView | the text to parse |
Returns: the value, or the failure and the byte offset it was found at
ParseInt512
pub func ParseInt512(str: char8[..]) -> int512 ! ParseError
pub func ParseInt512(str: StringView) -> int512 ! ParseError
Parses an int512: an optional sign, an optional base prefix, and digits.
The negative bound is one larger than the positive one, because the most negative value has no positive
counterpart: the value one past the largest positive fits only with its sign.
| Overload | Summary |
|---|---|
pub func ParseInt512(str: char8[..]) -> int512 ! ParseError | Parses an int512: an optional sign, an optional base prefix, and digits. |
pub func ParseInt512(str: StringView) -> int512 ! ParseError | The same grammar for a view, which is what a caller holding text has. |
Parameters
| Name | Type | Description |
|---|---|---|
str | char8[..] / StringView | the text to parse |
Returns: the value, or the failure and the byte offset it was found at
ParseBool
pub func ParseBool(str: char8[..]) -> bool ! ParseError
pub func ParseBool(str: StringView) -> bool ! ParseError
Parses true or false, exactly.
Reports Empty for no bytes and InvalidCharacter at the start for anything else, including a correct word
with trailing bytes.
| Overload | Summary |
|---|---|
pub func ParseBool(str: char8[..]) -> bool ! ParseError | Parses true or false, exactly. |
pub func ParseBool(str: StringView) -> bool ! ParseError | The same words for a view. |
Parameters
| Name | Type | Description |
|---|---|---|
str | char8[..] / StringView | the text to parse |
Returns: the value, or the failure and the byte offset it was found at
ParseChar
pub func ParseChar(str: char8[..]) -> char32 ! ParseError
pub func ParseChar(str: StringView) -> char32 ! ParseError
Parses exactly one character.
Reports Empty for no bytes, and InvalidCharacter for bytes that are not one whole scalar value — ill-formed
UTF-8 at zero, a second character at its own index.
| Overload | Summary |
|---|---|
pub func ParseChar(str: char8[..]) -> char32 ! ParseError | Parses exactly one character. |
pub func ParseChar(str: StringView) -> char32 ! ParseError | The same single character for a view. |
Parameters
| Name | Type | Description |
|---|---|---|
str | char8[..] / StringView | the text to parse |
Returns: the value, or the failure and the byte offset it was found at