Skip to main content

ToYaml

Trait ToYaml 

Source
pub trait ToYaml {
    // Required method
    fn to_yaml(&self, buf: &mut String);
}
Expand description

序列化方向:把一个 Dynamic 写成 YAML 文本。

输出风格刻意保持“LLM 友好“:

  • 默认 block style,序列用 - item,映射用 key: value
  • 字符串尽量裸出;只有会改变语义或被误读时才加双引号。
  • 多行字符串用 | literal block scalar,保留换行,避免 \n 转义噪声。
  • 不输出 anchor / alias / 显式 !!str 标签,这些东西 LLM 经常搞错。

Required Methods§

Source

fn to_yaml(&self, buf: &mut String)

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ToYaml for &str

Source§

fn to_yaml(&self, buf: &mut String)

Source§

impl ToYaml for i64

Source§

fn to_yaml(&self, buf: &mut String)

Implementors§