pub trait ToYaml: Serialize + Sized {
// Provided method
fn to_yaml(&self) -> Result<String, YamlError> { ... }
}Available on crate feature
yaml only.Expand description
Extension trait for serializing types to YAML.
This trait is implemented for all types that implement Serialize.
It provides a convenient to_yaml() method for generating YAML strings.
§Example
ⓘ
use clawspec_core::ToYaml;
use utoipa::openapi::OpenApi;
let spec: OpenApi = /* ... */;
let yaml = spec.to_yaml()?;
println!("{yaml}");Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.