pub fn to_value<T: ?Sized + Serialize>(v: &T) -> Result<BorrowedValue<'static>>Expand description
Serialize a value to a BorrowedValue.
This is the low-level entry point — use to_string
for a complete YAML string. Returning a BorrowedValue first is useful for
inspection or transformation before emission.
§Example
use serde::Serialize;
use yaml0::{to_value, BorrowedValue};
#[derive(Serialize)]
struct Point { x: i32, y: i32 }
let v = to_value(&Point { x: 1, y: 2 }).unwrap();
assert!(matches!(v, BorrowedValue::Map(_)));