domainforge-core 0.22.2

Rust core library implementing the SEA DSL primitives and validation engine.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
//! YAML emission shared by the projections that write YAML documents.

use serde_saphyr::SerializerOptions;

/// Serialize `value` to YAML with the projection options. Block scalars (`|`/`>`)
/// are disabled so every string stays a single scalar with no folding; the default
/// YAML 1.1 quoting rules quote values that any YAML 1.1/1.2 reader could type as a
/// bool, number, null, or timestamp. Anchors are never generated.
pub(crate) fn to_yaml<T: serde::Serialize>(value: &T) -> Result<String, serde_saphyr::ser::Error> {
    let mut options = SerializerOptions::default();
    options.prefer_block_scalars = false;
    serde_saphyr::to_string_with_options(value, options)
}