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§
- Parse
Name Error - An error which can be returned when parsing an EOSIO name.
- Parse
Symbol Code Error - An error which can be returned when parsing an EOSIO symbol.
- Parse
Symbol Error - 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.