Skip to main content

labels_from_cell_names

Function labels_from_cell_names 

Source
pub fn labels_from_cell_names(
    sheet: &Sheet,
    cell_names: &IndexMap<String, (CellId, TypeShape)>,
) -> Labels
Expand description

Builds a Labels from an adam-lang-style declaration-ordered cell name map.

Matches each scalar cell’s TypeId against the built-in primitive types adam_lang::TypeRegistry::new() registers. Tuple and array cells appear with a Debug-formatted, display-only entry via Labels::add_compound_cell. Cells whose TypeId is none of the built-in primitives, including callable signatures, remain visible with an explicit unsupported-codec diagnostic.

  • Complexity: O(n + t + s) registration work for cells n, copied label bytes t, and prepared compound type structure s; later value formatting has its own costs.

§Examples

let parsed = adam_lang::AdamParser::new(adam_lang::TypeRegistry::new(), cel_parser::OpLookup::new())
    .parse_str("sheet example { cell width: i64; }").unwrap();
let labels = adam_web_ui::labels_from_cell_names(&parsed, &parsed.cell_names);
assert!(labels.cells[&parsed.cell_names["width"].0].is_integer);