Struct fuels_core::tokenizer::Tokenizer
source · pub struct Tokenizer;
Implementations§
source§impl Tokenizer
impl Tokenizer
sourcepub fn tokenize(param: &ParamType, value: String) -> Result<Token, Error>
pub fn tokenize(param: &ParamType, value: String) -> Result<Token, Error>
Takes a ParamType and a value string and joins them as a single Token that holds the value within it. This Token is used in the encoding process.
sourcepub fn tokenize_struct(value: &str, params: &[ParamType]) -> Result<Token, Error>
pub fn tokenize_struct(value: &str, params: &[ParamType]) -> Result<Token, Error>
Creates a Token::Struct
from an array of parameter types and a string of values.
I.e. it takes a string containing values “value_1, value_2, value_3” and an array
of ParamType
containing the type of each value, in order:
[ParamType::Token::Struct()
containing the inner types.
It works for nested/recursive structs.
sourcepub fn tokenize_array(value: &str, param: &ParamType) -> Result<Token, Error>
pub fn tokenize_array(value: &str, param: &ParamType) -> Result<Token, Error>
Creates a Token::Array
from one parameter type and a string of values. I.e. it takes a
string containing values “value_1, value_2, value_3” and a ParamType
specifying the type.
It works for nested/recursive arrays.
pub fn tokenize_vec(value: &str, param: &ParamType) -> Result<Token, Error>
sourcepub fn tokenize_tuple(value: &str, params: &[ParamType]) -> Result<Token, Error>
pub fn tokenize_tuple(value: &str, params: &[ParamType]) -> Result<Token, Error>
Creates Token::Tuple
from an array of parameter types and a string of values.
I.e. it takes a string containing values “value_1, value_2, value_3” and an array
of ParamType
containing the type of each value, in order:
[ParamType::Token::Tuple()
containing the inner types.
It works for nested/recursive tuples.