pub trait JsonTryAsExt {
// Required methods
fn try_null(&self) -> DamlJsonCodecResult<()>;
fn try_bool(&self) -> DamlJsonCodecResult<bool>;
fn try_int64(&self) -> DamlJsonCodecResult<i64>;
fn try_string(&self) -> DamlJsonCodecResult<&str>;
fn try_array(&self) -> DamlJsonCodecResult<&Vec<Value>>;
fn try_object(&self) -> DamlJsonCodecResult<&Map<String, Value>>;
// Provided methods
fn make_unexpected_type_error(
value: &Value,
expected: &str,
) -> DamlJsonCodecError { ... }
fn json_value_name(value: &Value) -> &str { ... }
}Expand description
Extension trait for JSON Value to add try_xxx methods.
Required Methods§
fn try_null(&self) -> DamlJsonCodecResult<()>
fn try_bool(&self) -> DamlJsonCodecResult<bool>
fn try_int64(&self) -> DamlJsonCodecResult<i64>
fn try_string(&self) -> DamlJsonCodecResult<&str>
fn try_array(&self) -> DamlJsonCodecResult<&Vec<Value>>
fn try_object(&self) -> DamlJsonCodecResult<&Map<String, Value>>
Provided Methods§
fn make_unexpected_type_error( value: &Value, expected: &str, ) -> DamlJsonCodecError
fn json_value_name(value: &Value) -> &str
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.