Crate eosio_numstr

Source
Expand description

This crate provides functions for converting EOSIO names and symbols to and from string representations.

Creating an EOSIO name:

use eosio_numstr::name_from_bytes;
let name = name_from_bytes("eosio".bytes()).unwrap();
assert_eq!(name, 6138663577826885632);

Creating an EOSIO symbol:

use eosio_numstr::symbol_from_bytes;
let symbol = symbol_from_bytes(4, "EOS".bytes()).unwrap();
assert_eq!(symbol, 1162826500);

Enums§

ParseNameError
An error which can be returned when parsing an EOSIO name.
ParseSymbolCodeError
An error which can be returned when parsing an EOSIO symbol.
ParseSymbolError
An error which can be returned when parsing an EOSIO symbol.

Constants§

NAME_CHARS
All possible characters that can be used in EOSIO names.
NAME_MAX_LEN
The maximum character length of an EOSIO name.
SYMBOL_CODE_CHARS
All possible characters that can be used in EOSIO symbol codes.
SYMBOL_CODE_MAX_LEN
The maximum allowed length of EOSIO symbol codes.

Functions§

name_from_bytes
Attempts to create an EOSIO name from an Iterator.
name_to_bytes
Converts an EOSIO name into an array of UTF-8 characters.
symbol_code_from_bytes
Attempts to create an EOSIO symbol from an Iterator.
symbol_code_to_bytes
Converts an EOSIO symbol into an array of UTF-8 characters.
symbol_from_bytes
Attempts to create an EOSIO symbol from an Iterator.
symbol_from_code
symbol_to_code
Gets an EOSIO symbol’s code.
symbol_to_precision
Gets an EOSIO symbol’s precision.