MCPcopy Create free account
hub / github.com/ddimaria/rust-blockchain-tutorial / parse_params

Function parse_params

runtime/src/contract.rs:44–50  ·  view source on GitHub ↗

TODO(ddimaria): remove unwrap

(chunk: &[&str])

Source from the content-addressed store, hash-verified

42
43// TODO(ddimaria): remove unwrap
44fn parse_params(chunk: &[&str]) -> Result<Val> {
45 match chunk[0] {
46 "String" => Ok(Val::String(chunk[1].into())),
47 "U64" => Ok(Val::U64(chunk[1].parse::<u64>().unwrap())),
48 _ => Err(RuntimeError::InvalidParamType(chunk[0].into())),
49 }
50}
51
52// for debugging exportable functions
53fn contract_functions(bytes: &[u8]) -> Vec<String> {

Callers 2

it_parses_string_paramsFunction · 0.85
it_parses_u64_paramsFunction · 0.85

Calls

no outgoing calls

Tested by 2

it_parses_string_paramsFunction · 0.68
it_parses_u64_paramsFunction · 0.68