pub struct Labels {
pub cells: IndexMap<CellId, CellMeta>,
}Expand description
Associates human-readable labels and type-erased closures with stable sheet IDs.
Fields§
§cells: IndexMap<CellId, CellMeta>Cells in insertion order (preserves display ordering).
Implementations§
Source§impl Labels
impl Labels
Sourcepub fn add_cell<T>(&mut self, id: CellId, label: &str)
pub fn add_cell<T>(&mut self, id: CellId, label: &str)
Registers display metadata for a cell of type T.
- Precondition:
idis a live cell in the sheet thisLabelswill be used with. - Precondition:
Tmatches the type registered withSheet::add_cellforid.
Sourcepub fn add_compound_cell(&mut self, sheet: &Sheet, id: CellId, label: &str)
pub fn add_compound_cell(&mut self, sheet: &Sheet, id: CellId, label: &str)
Registers display-only metadata for a canonical compound cell of any shape.
write_str always returns Err — no compound editor exists yet (tracked as a
follow-up: see the “Support editing tuple-typed cells in begin” GitHub issue). The
field still participates fully in crate::SheetInspector’s existing
invalid/warning/disabled machinery, since that’s entirely keyed on CellId, not on any
per-type behavior.
Missing storage or formatting capability displays ?; unsupported writes
always return an explicit error without mutating the sheet.
- Complexity: Preparation O(1); display O(n + v + s) for n type nodes, v values and s output bytes, excluding leaf formatter costs.
§Examples
let sheet = adam_lang::AdamParser::new(adam_lang::TypeRegistry::new(), cel_parser::OpLookup::new())
.parse_str("sheet s { cell xs: [i32]; }").unwrap();
let id = sheet.cell_names["xs"].0;
let mut labels = adam_web_ui::Labels::new();
labels.add_compound_cell(&sheet, id, "xs");
assert_eq!((labels.cells[&id].display)(&sheet), "[]");Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Labels
impl !Send for Labels
impl !Sync for Labels
impl !UnwindSafe for Labels
impl Freeze for Labels
impl Unpin for Labels
impl UnsafeUnpin for Labels
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Create an instance of this type from an initialization function
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.