Expand description
Serializer options for YAML emission.
Controls indentation and optional anchor name generation for the serializer.
Example: use 4-space indentation and a custom anchor naming scheme.
use serde::Serialize;
#[derive(Serialize)]
struct Item { a: i32, b: bool }
let mut buf = String::new();
let opts = serde_saphyr::ser_options! {
indent_step: 4,
anchor_generator: Some(|id| format!("id{}/", id)),
};
serde_saphyr::to_fmt_writer_with_options(&mut buf, &Item { a: 1, b: true }, opts).unwrap();
assert!(buf.contains("a: 1"));Structsยง
- Serializer
Options - Serializer options for YAML emission.