Module value

Module value 

Source
Expand description

An Uniform Resource value.

The Value type aggregates every known UR type (by this crate) into a single enumeration variant containing those.

This can be used to parse a Uniform Resource by checking on the UR type and then calling the corresponding decoder.

§Example

Parsing a UR:

// As a UR: ur:bytes/gdaebycpeofygoiyktlonlpkrksfutwyzmwmfyeozs
use foundation_urtypes::value::Value;
const PAYLOAD: &[u8] = &[
    0x50, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD,
    0xEE, 0xFF,
];
const UR_TYPE: &str = "bytes";

let value = Value::from_ur(UR_TYPE, PAYLOAD).unwrap();
println!("{:?}", value);

Enums§

Error
Errors that can occur when parsing a value.
Value