ipld_from_cbor

Function ipld_from_cbor 

Source
pub fn ipld_from_cbor(data: &[u8]) -> Result<Ipld>
Expand description

Decodes IPLD data from DAG-CBOR bytes.

ยงExamples

use ipfrs_core::{utils::{ipld_to_cbor, ipld_from_cbor}, Ipld};

let ipld = Ipld::String("hello".to_string());
let cbor = ipld_to_cbor(&ipld).unwrap();
let decoded = ipld_from_cbor(&cbor).unwrap();
assert_eq!(ipld, decoded);