serde-ast
Define an AST representation of serde serialization.
use ;
use to_ast;
let example = Example ;
let ast = to_ast.expect;
println!;
Struct {
name: "Example",
len: 1,
ops: [
Field {
key: "hello",
value: Str(
"World",
),
},
],
}
Serializing the [Ast] is equivalent to directly serializing the original value.
// serialize the ast
let output = to_string.expect;
// serialize the value directly
let direct = to_string.expect;
// the result is the same
assert_eq!;