Skip to main content

compile

Function compile 

Source
pub fn compile(
    yaml_source: &str,
    options: &CompileOptions,
) -> Result<Vec<u8>, String>
Expand description

Compile a .faf YAML source string into .fafb binary bytes.

Every top-level YAML key becomes a section with a string table entry. Keys are classified as DNA/Context/Pointer automatically.

ยงExample

use faf_rust_sdk::binary::compile::{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");