Skip to main content

initialize_sheet

Function initialize_sheet 

Source
pub fn initialize_sheet(parsed: ParsedSheet) -> Result<BuiltSheet, BuildError>
Expand description

Propagates an explicitly selected parsed root and returns it only if valid.

Capture diagnostics before mutation. If propagation fails, discard the unspecified candidate and return only its typed error and owned metadata.

§Errors

Returns a runtime or validation error when initial propagation fails or a requirement evaluates to false.

  • Complexity: O(m) metadata snapshot cost plus propagation and validation work, where m is the retained metadata size.

§Examples

use adam_lang::{AdamParser, TypeRegistry};
let parsed = AdamParser::new(TypeRegistry::new(), cel_parser::OpLookup::new())
    .parse_str("sheet example { cell width: i64 = 10i64; }")
    .unwrap();
let built = adam_web_ui::initialize_sheet(parsed).unwrap();
assert!(built.keys.contains_key("width"));