Skip to main content

compose_dcbor_map

Function compose_dcbor_map 

Source
pub fn compose_dcbor_map(array: &[&str]) -> Result<CBOR>
Expand description

Composes a dCBOR map from a slice of string slices, and returns a CBOR object representing the map.

The length of the slice must be even, as each key must have a corresponding value.

Each string slice is parsed as a dCBOR item.

ยงExample

let cbor = compose_dcbor_map(&["1", "2", "3", "4"]).unwrap();
assert_eq!(cbor.diagnostic(), "{1: 2, 3: 4}");