Closed SionoiS closed 1 year ago
I don't fully understand what you mean. Could you perhaps provide a minimal example?
Here's what I tried (I've added that to serde_ipld_dacbor/tests/ipld.rs
to run it):
#[test]
fn test_ipld_reference() {
let ipld = Ipld::String("Hello, world!".to_string());
let data_ser = serde_ipld_dagcbor::to_vec(&ipld).unwrap();
println!("{:?}", data_ser);
assert!(false);
}
Oh, as I posted this, I saw that it's a pretty old issue. I was replying to a comment, that was since deleted. Does this mean that the issue got fixed? :)
@vmx ah sorry. I figured out how to do it. Thank you! Perhaps my question doesn't much about this issue 100%
I want to get a reference to
&Ipld
without cloning the data into the enum.Would be useful to serialize types with
serde_json
orserde_ipld_dagcbor
without consuming them.We know that some type could be used without cloning so maybe implement
AsRef<Ipld>
for builtin types as starting point?