Expand description
Zero-copy YAML values that borrow strings from the input.
BorrowedValue is the zero-copy counterpart of Value.
String scalars and mapping keys use Cow<'a, str>, borrowing directly from
the input buffer when no escape processing was needed. This eliminates heap
allocations for the majority of YAML content.
§Examples
use noyalib::borrowed::{from_str_borrowed, BorrowedValue};
let yaml = "name: noyalib\nversion: 1\n";
let value: BorrowedValue<'_> = from_str_borrowed(yaml).unwrap();
assert_eq!(value.as_mapping().unwrap().get("name").unwrap().as_str(), Some("noyalib"));Enums§
- Borrowed
Value - A zero-copy YAML value that borrows strings from the input.
- Transform
Reason - Why a YAML scalar could not be borrowed directly from the input
buffer and had to be materialised into an owned
String.
Functions§
- from_
str_ borrowed - Parse YAML into a zero-copy
BorrowedValuethat borrows from the input. - from_
str_ borrowed_ with_ config - Parse YAML into a zero-copy
BorrowedValuewith custom security limits.