Skip to main content

Labels

Struct Labels 

Source
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

Source

pub fn new() -> Self

Creates an empty label set.

Source

pub fn add_cell<T>(&mut self, id: CellId, label: &str)
where T: Any + Display + FromStr + 'static, T::Err: Display,

Registers display metadata for a cell of type T.

  • Precondition: id is a live cell in the sheet this Labels will be used with.
  • Precondition: T matches the type registered with Sheet::add_cell for id.
Source

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§

Source§

impl Default for Labels

Source§

fn default() -> Self

Returns Labels::new().

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> InitializeFromFunction<T> for T

§

fn initialize_from_function(f: fn() -> T) -> T

Create an instance of this type from an initialization function
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<Ret> SpawnIfAsync<(), Ret> for Ret

§

fn spawn(self) -> Ret

Spawn the value into the dioxus runtime if it is an async block
§

impl<T, O> SuperFrom<T> for O
where O: From<T>,

§

fn super_from(input: T) -> O

Convert from a type to another type.
§

impl<T, O, M> SuperInto<O, M> for T
where O: SuperFrom<T, M>,

§

fn super_into(self) -> O

Convert from a type to another type.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more