pub struct Labels {
pub cells: IndexMap<CellId, CellMeta>,
}Expand description
Associates human-readable labels and type-erased closures with stable sheet IDs.
§Examples
labels_from_cell_names(&parsed, &parsed.cell_names) creates declaration-ordered
metadata suitable for a SheetInspector.
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. - Precondition:
T’sDisplay/FromStrpair satisfiesScalarCodec’s preservation contract; otherwise useSelf::add_cell_with_codec.
Infers Boolean and primitive numeric classification. Use
labels_from_cell_names to attach live filter-range metadata.
- Complexity: O(label.len()) registration time and space; display and parsing callbacks subsequently incur their concrete type’s formatting/parsing costs.
§Examples
let mut sheet = adam_rs::Sheet::new();
let id = sheet.add_cell(3i64);
let mut labels = adam_web_ui::Labels::new();
labels.add_cell::<i64>(id, "count");
assert_eq!((labels.cells[&id].display)(&sheet), "3");Sourcepub fn add_cell_with_codec<T: Any>(
&mut self,
id: CellId,
label: &str,
codec: ScalarCodec<T>,
)
pub fn add_cell_with_codec<T: Any>( &mut self, id: CellId, label: &str, codec: ScalarCodec<T>, )
Registers a custom scalar with an exact encoder and decoder.
- Precondition:
idstoresTin the associated sheet. - Precondition:
codecsatisfiesScalarCodec’s preservation contract. - Complexity: O(label bytes) registration; callbacks incur codec costs.
§Examples
let mut sheet = adam_rs::Sheet::new();
let id = sheet.add_cell(true);
let mut labels = adam_web_ui::Labels::new();
labels.add_cell_with_codec(id, "enabled", adam_web_ui::ScalarCodec {
encode: bool::to_string,
decode: |s| s.parse::<bool>()
.map_err(|e| adam_web_ui::input::InputError::Lexical(e.to_string())),
});
assert_eq!((labels.cells[&id].capture)(&sheet).unwrap(), "true");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.
prepare and capture return Err — no exact compound codec 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<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
replaced by palette::chromatic_adaptation::AdaptIntoUnclamped
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
replaced by palette::chromatic_adaptation::AdaptIntoUnclamped
Source§impl<T, C> AdaptIntoUnclamped<T> for Cwhere
T: AdaptFromUnclamped<C>,
impl<T, C> AdaptIntoUnclamped<T> for Cwhere
T: AdaptFromUnclamped<C>,
Source§type Scalar = <T as AdaptFromUnclamped<C>>::Scalar
type Scalar = <T as AdaptFromUnclamped<C>>::Scalar
Source§fn adapt_into_unclamped_with<M>(self) -> Twhere
M: LmsToXyz<<C as AdaptIntoUnclamped<T>>::Scalar> + XyzToLms<<C as AdaptIntoUnclamped<T>>::Scalar>,
fn adapt_into_unclamped_with<M>(self) -> Twhere
M: LmsToXyz<<C as AdaptIntoUnclamped<T>>::Scalar> + XyzToLms<<C as AdaptIntoUnclamped<T>>::Scalar>,
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
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
Source§impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle.Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other into Self, while performing the appropriate scaling,
rounding and clamping.§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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T.Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Source§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self into T, while performing the appropriate scaling,
rounding and clamping.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
§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
Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains
the unclamped color. Read more