pub fn compile(
yaml_source: &str,
options: &CompileOptions,
) -> Result<Vec<u8>, String>Expand description
Compile a .faf YAML source string into .fafb v2 binary bytes.
FAFb v2 is closed canonical: only the canonical chunk set produces
sections, serialized in canonical order. Non-canonical top-level keys are
folded into the context chunk (sorted alphabetically, after any authored
context content) — preserved, never named.
§Example
use faf_fafb::{compile, CompileOptions};
let yaml = r#"
faf_version: 2.5.0
project:
name: my-project
goal: Build something great
custom_data:
key: value
"#;
let opts = CompileOptions { use_timestamp: false };
let fafb_bytes = compile(yaml, &opts).unwrap();
assert_eq!(&fafb_bytes[0..4], b"FAFB");
assert_eq!(fafb_bytes[4], 2); // FAFb v2