Module utils

Source
Expand description

Utilities for calling JavaScript functions and retrieving values from JavaScript object properties.

Functionsยง

apply_with_args0
Call a JavaScript function without arguments
apply_with_args1
Call a JavaScript function with a single argument
apply_with_args2
Call a JavaScript function with two arguments
try_get_bool_from_prop
Obtain a bool value from the object property prop
try_get_f64_from_prop
Obtain f64 value from an object property. Results in an Error if the value is not a number.
try_get_js_value_prop
Obtain a JsValue from a JavaScript object property. Results in an Error if the property does not exist.
try_get_string_from_prop
Obtain a String value from the object property prop
try_get_u8_from_prop
Obtain u8 value from the object property prop. Results in an Error if the value is not a number or the number value is out of bounds (0..u8::MAX).
try_get_u16_from_prop
Obtain u16 value from the object property prop. Results in an Error if the value is not a number or the number value is out of bounds (0..u16::MAX).
try_get_u32_from_prop
Obtain u32 value from the object property prop.
try_get_u64_from_prop
Obtain a u64 value from an object property. Results in an Error if the value is not a number, rounded u64 if the value is a number.
try_get_vec_from_prop
Obtain Vec<JsValue> by treating the object property prop as an array
try_get_vec_u8_from_bn
Obtain Vec<u8> from the supplied big number
try_get_vec_u8_from_bn_prop
Obtain a Vec<u8> from the property prop expressed as a big number
try_get_vec_u8_from_number_array_prop
Obtain a Vec<u8> value from the object property prop (using Uint8Array)
try_get_vec_u8_from_uint8_array_prop
Obtain a Vec<u8> value from the object property prop (using Uint8Array)