pub fn to_arc_node(any: impl Serialize) -> Result<ArcNode, SerdeError>
This is supported on crate feature serde only.
Expand description

Serialize data into ArcNode.

use serde::Serialize;
use yaml_peg::{serialize::to_arc_node, node};

#[derive(Serialize)]
struct Member<'a> {
    name: &'a str,
    married: bool,
    age: u8,
}

let officer = Member { name: "Bob", married: true, age: 46 };
let officer_yaml = node!(arc{
    "name" => "Bob",
    "married" => true,
    "age" => 46,
});
assert_eq!(officer_yaml, to_arc_node(officer).unwrap());

There is another version for single-thread reference counter: to_node.