Merge pull request #2965 from dotCooCoo/feat/unit-text

Units: number rows can show unit text, and UnitKind gains Milliseconds
This commit is contained in:
BFlat authored and GitHub committed 2026-11-27 14:16:13 +07:00
commit bb84da2f88
11 files changed
+211 -18

No files matched your search

+9 -2
View File
@@ -37,6 +37,7 @@ craft_ui::words! {
minutes: unit "units.minutes" = "{n} min";
columns: unit "units.columns" = "{n} col";
per_inch: unit "units.perInch" = "{n}/in";
milliseconds: unit "units.milliseconds" = "{n} ms";
pixels_name: "units.pixelsName" = "Pixels";
percent_name: "units.percentName" = "Percent";
degrees_name: "units.degreesName" = "Degrees";
@@ -60,6 +61,7 @@ craft_ui::words! {
letters_name: "units.lettersName" = "Letters";
hyphens_name: "units.hyphensName" = "Hyphens";
per_inch_name: "units.perInchName" = "Per Inch";
milliseconds_name: "units.millisecondsName" = "Milliseconds";
}
}
@@ -173,6 +175,8 @@ pub enum UnitKind {
/// `{n}/in`: how many of something fall in an inch of length, such as the points a distortion adds along a path.
/// It is a count, not a length: [`per_inch`](Self::per_inch) answers `None` for it.
PerInch,
/// `{n} ms`: a duration or delay in milliseconds.
Milliseconds,
}
impl UnitKind {
@@ -186,7 +190,7 @@ impl UnitKind {
Self::ALL.get(tag as usize).copied()
}
const ALL: [UnitKind; 23] = [
const ALL: [UnitKind; 24] = [
UnitKind::Pixels,
UnitKind::Percent,
UnitKind::Degrees,
@@ -210,12 +214,13 @@ impl UnitKind {
UnitKind::Letters,
UnitKind::Hyphens,
UnitKind::PerInch,
UnitKind::Milliseconds,
];
/// The digits after the decimal mark a number of this kind shows by default, at most.
pub const fn decimals(self) -> RangeInclusive<usize> {
match self {
UnitKind::Pixels | UnitKind::Minutes | UnitKind::Letters | UnitKind::Hyphens => 0..=0,
UnitKind::Pixels | UnitKind::Minutes | UnitKind::Letters | UnitKind::Hyphens | UnitKind::Milliseconds => 0..=0,
UnitKind::Percent | UnitKind::Degrees | UnitKind::Points => 0..=1,
UnitKind::Q | UnitKind::Ha => 0..=2,
UnitKind::Feet | UnitKind::Yards | UnitKind::Metres => 0..=4,
@@ -476,6 +481,7 @@ impl Units {
UnitKind::Letters => words.letters.as_str(),
UnitKind::Hyphens => words.hyphens.as_str(),
UnitKind::PerInch => words.per_inch.as_str(),
UnitKind::Milliseconds => words.milliseconds.as_str(),
}
}
@@ -506,6 +512,7 @@ impl Units {
UnitKind::Letters => &words.letters_name,
UnitKind::Hyphens => &words.hyphens_name,
UnitKind::PerInch => &words.per_inch_name,
UnitKind::Milliseconds => &words.milliseconds_name,
};
name.clone()
}
+2 -1
View File
@@ -598,7 +598,8 @@ fn a_dialog_moves_by_the_padding_around_its_title() {
};
let start = dialog(&fixture);
let line = title(&fixture);
assert!(line.top() > start.top(), "the title lies inside the frame's padding: {line:?} in {start:?}");
let padding = crate::runtime::env::Env::of_root(fixture.ctx()).tokens.space.pad.dialog;
assert!(line.top() - start.top() >= padding, "the title lies inside the frame's padding: {line:?} in {start:?}");
let points = [
("above the title", Pos2::new(line.center().x, (start.top() + line.top()) / 2.0)),
("before the title", Pos2::new((start.left() + line.left()) / 2.0, line.center().y)),
@@ -730,6 +730,8 @@ fn is_path_list(value: &FieldValue) -> bool {
struct RowTexts {
hint: Option<Label>,
tooltip: Option<Tooltip>,
/// The text after the number ([`Param::unit_label`]).
unit: Option<Label>,
}
/// When a row takes input.
@@ -1389,6 +1391,15 @@ impl Param {
self
}
/// Text shown after the number of a number, int, optional-number or range row in place of the symbol of its
/// [`unit`](Self::unit), for a quantity no [`UnitKind`] names (`kbps`, `MB`). The host passes it in the user's
/// language. Typed text is still read by the row's `unit`, or as a plain number without one.
#[must_use]
pub fn unit_label(mut self, text: impl Into<Label>) -> Self {
self.texts.get_or_insert_default().unit = Some(text.into());
self
}
/// Parses the registry notation into a list, labels from the keys in Title Case with two fixed names (`cellSize`
/// is `Cell Size`, `bpc` is `Black Point Compensation`;
/// `{"radius":0.1..1000=1,"method":"spin|zoom","monochromatic":bool,"seed":u32=0}`). Apps with their own command
@@ -1426,6 +1437,11 @@ impl Param {
self.texts.as_deref()?.tooltip.as_ref()
}
/// The text after the row's number ([`Param::unit_label`]).
pub(crate) fn unit_label_text(&self) -> Option<&Label> {
self.texts.as_deref()?.unit.as_ref()
}
/// The label a [`Param::in_footer`] row shows while on; `None` for a row in the body.
pub(crate) fn footer_on(&self) -> Option<Label> {
self.options.as_deref()?.footer_on.clone()
@@ -504,8 +504,14 @@ impl Line<'_> {
fixed: bool,
) -> NumberField<'static> {
let unit = self.param.unit;
let field = bound_field(units, self.name.clone(), value, decimals, unit, codec, fixed);
if let Some(unit) = unit { field.unit_kind(unit) } else { field }
let mut field = bound_field(units, self.name.clone(), value, decimals, unit, codec, fixed);
if let Some(unit) = unit {
field = field.unit_kind(unit);
}
if let Some(text) = self.param.unit_label_text() {
field = field.unit(text.clone());
}
field
}
/// Shows `body` across the form for a full-width row, without a label, or else beside the row's label.
@@ -873,6 +879,9 @@ impl<'p> Pass<'p> {
if let Some(kind) = line.param.unit {
slider = slider.unit_kind(kind);
}
if let Some(text) = line.param.unit_label_text() {
slider = slider.unit(text.clone());
}
if layout == SliderFieldLayout::Stacked {
slider = slider.id_salt(line.key).enabled(line.enabled);
if let Some(tip) = line.param.tooltip_text() {
@@ -906,7 +915,8 @@ impl<'p> Pass<'p> {
// Match the ordinary range row's number field precision when the caller sets no step.
let default_step = if range.end() - range.start() <= 10.0 { 0.01 } else { 1.0 };
let step = set_step.unwrap_or(default_step);
let unit = line.param.unit.map(|kind| (kind, self.units.symbol(kind)));
let kind = line.param.unit;
let symbol: Option<Label> = line.param.unit_label_text().cloned().or_else(|| kind.map(|kind| self.units.symbol(kind).into()));
let default = line.param.default_value().and_then(number_of).map(Some);
line.show(ui, |ui| {
Row::new().show(ui, |ui, _| {
@@ -919,11 +929,14 @@ impl<'p> Pass<'p> {
if set_step.is_some() || default_step != 1.0 {
field = field.step(step).snap_typed(set_step.is_some());
}
if let Some((kind, _)) = &unit {
field = field.unit_kind(*kind).unit_placement(UnitPlacement::After);
if let Some(kind) = kind {
field = field.unit_kind(kind);
}
if symbol.is_some() {
field = field.unit_placement(UnitPlacement::After);
}
let shown = field.show(ui);
if let Some((_, symbol)) = &unit {
if let Some(symbol) = &symbol {
Text::new(symbol.clone()).show(ui);
}
self.alert(shown.out_of_range);
@@ -947,6 +960,9 @@ impl<'p> Pass<'p> {
(None, codec) => line.scalar_field(self.units, line.bind(Some(value), default), decimals, codec, self.shaded),
}
.step(step);
if let Some(text) = line.param.unit_label_text() {
field = field.unit(text.clone());
}
if let Some(range) = range.clone() {
field = field.range(range);
}
@@ -84,6 +84,19 @@ fn param_rows(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
ParamRows::new("Filter", &params, fields_at.bind(fields)).patterns(&patterns).show(ui).into()
}
/// Number, int and range rows with unit text no `UnitKind` names (`kbps`, `s`, `MiB`) beside a row in milliseconds.
#[story(ParamRows<'static>, covers = [], drive = Drive::Never)]
fn param_rows_unit_labels(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
let params = vec![
Param::number("bitrate", "Bitrate", 6000.0, 50.0, 0).bounds(Some(100.0), Some(200_000.0)).unit_label("kbps"),
Param::new("keyframes", "Keyframe interval", ParamKind::int(Some(1), Some(20), 2)).unit_label("s"),
Param::new("offset", "Sync offset", ParamKind::number(Some(0.0), Some(20_000.0), 0.0, 1.0, 0)).unit(UnitKind::Milliseconds),
Param::new("buffer", "Buffer", ParamKind::range(1.0, 512.0, 64.0, Default::default())).unit_label("MiB"),
];
let (fields, fields_at) = data.value_at("fields", DialogFields::new());
ParamRows::new("Output", &params, fields_at.bind(fields)).show(ui).into()
}
/// The rows of `params` over the story's values, which `setup` may prepare once.
fn rows_story(ui: &mut Ui, data: &mut StoryData, params: &[Param], setup: impl FnOnce(&mut DialogFields)) -> StoryOutput {
if data.present::<DialogFields>("fields").is_none() {
@@ -104,12 +104,14 @@ pub(super) fn step_for(range: &RangeInclusive<f64>, decimals: u8) -> f64 {
if decimals == 0 || range.end() - range.start() >= 10.0 { 1.0 } else { 10f64.powi(-i32::from(decimals)) }
}
/// A number field over `value`. A counted `unit` wins over `unit_text`, which is for quantities with no `UnitKind`.
/// A number field over `value` that reads the spellings of `unit` and shows its symbol after the number, or else
/// `unit_text`. A counted `unit` wins over `unit_text`, which is for quantities with no `UnitKind`.
fn number(units: &Units, label: &Label, value: f64, unit: Option<UnitKind>, unit_text: Option<&Label>, decimals: usize) -> NumberField<'static> {
let field = NumberField::new(label.clone(), Bind::given(Some(value))).codec(NumberCodec::new(units.reader(unit), decimals));
match unit_text {
Some(text) if unit.is_none() => field.unit(text.clone()),
_ => field,
match (unit, unit_text) {
(Some(kind), _) => field.unit_kind(kind),
(None, Some(text)) => field.unit(text.clone()),
(None, None) => field,
}
}
@@ -22,6 +22,10 @@ struct Values {
margin: f64,
/// In seconds.
delay: f64,
/// The preview cache's limit, in megabytes: a unit no `UnitKind` names.
cache: i64,
/// The length of a preview's fade, in milliseconds.
fade: i64,
load_plugins: bool,
plugin_folder: String,
}
@@ -37,6 +41,8 @@ impl Default for Values {
tint: Rgba([0xff, 0x88, 0x00, 0xff]),
margin: 36.0,
delay: 0.5,
cache: 512,
fade: 250,
load_plugins: true,
plugin_folder: "Plug-ins".to_owned(),
}
@@ -78,6 +84,8 @@ impl PreferencesModel for Demo {
RowKind::length(draft.margin, 0.0..=720.0, LengthUnits::new(UnitKind::Points, UnitKind::Millimetres, 72.0)),
),
RowSpec::new("canvas.delay", "Preview delay", RowKind::float(draft.delay, 0.0..=10.0, 1).unit_text("s")),
RowSpec::new("canvas.cache", "Preview cache", RowKind::int(draft.cache, 64..=8192).unit_text("MB")),
RowSpec::new("canvas.fade", "Preview fade", RowKind::int(draft.fade, 0..=2000).counting(UnitKind::Milliseconds)),
],
)
.footnote("Canvas settings apply to new documents."),
@@ -102,6 +110,8 @@ impl PreferencesModel for Demo {
("canvas.tint", PrefValue::Color(tint)) => self.draft.tint = tint,
("canvas.margin", PrefValue::Float(margin)) => self.draft.margin = margin,
("canvas.delay", PrefValue::Float(delay)) => self.draft.delay = delay,
("canvas.cache", PrefValue::Int(cache)) => self.draft.cache = cache,
("canvas.fade", PrefValue::Int(fade)) => self.draft.fade = fade,
("plugins.load", PrefValue::Bool(on)) => self.draft.load_plugins = on,
("plugins.folder", PrefValue::Text(text)) => self.draft.plugin_folder = text,
_ => {}
@@ -123,6 +133,7 @@ impl PreferencesModel for Demo {
"canvas" => {
(self.draft.size, self.draft.opacity, self.draft.tint) = (defaults.size, defaults.opacity, defaults.tint);
(self.draft.margin, self.draft.delay) = (defaults.margin, defaults.delay);
(self.draft.cache, self.draft.fade) = (defaults.cache, defaults.fade);
}
"plugins" => (self.draft.load_plugins, self.draft.plugin_folder) = (defaults.load_plugins, defaults.plugin_folder),
_ => {}
@@ -174,6 +185,13 @@ fn preferences_window_without_matches(ui: &mut Ui, data: &mut StoryData) -> Stor
window(ui, data, state, Demo::default())
}
/// The Canvas page: number rows with a unit kind's symbol (`px`, `ms`) and with unit text (`s`, `MB`) after the field.
#[story(PreferencesWindow<'static>, covers = [], drive = Drive::Never)]
fn preferences_window_with_units(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
let state = PreferencesState { selected: "canvas".to_owned(), ..PreferencesState::default() };
window(ui, data, state, Demo::default())
}
/// The custom Plug-ins page: the host's part, then the page's own titled group.
#[story(PreferencesWindow<'static>, covers = [], drive = Drive::Never)]
fn preferences_window_custom_page(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
@@ -925,6 +925,66 @@ fn parameter_dialogs_15539_show_declared_units_and_keep_parsing() {
}
}
/// Unit text shows after the number of number, int, range and popup range rows, in place of the symbol of a row's unit
/// kind when it has one, and the kind still reads typed text; a row in milliseconds shows `ms` and reads `250 ms`.
#[trial]
fn rows_show_unit_text_and_milliseconds() {
let params = vec![
Param::number("bitrate", "Bitrate", 6000.0, 50.0, 0).unit_label("kbps"),
Param::new("keyframes", "Keyframe interval", ParamKind::int(Some(1), Some(20), 2)).unit_label("s"),
Param::new("offset", "Sync offset", ParamKind::number(Some(0.0), Some(20_000.0), 0.0, 1.0, 0)).unit(UnitKind::Milliseconds),
Param::new("delay", "Delay", ParamKind::number(Some(0.0), Some(1000.0), 0.0, 1.0, 0)).unit(UnitKind::Milliseconds).unit_label("msec"),
Param::new("buffer", "Buffer", ParamKind::range(1.0, 512.0, 64.0, SliderScale::Linear)).unit_label("MiB"),
Param::new("size", "Size", ParamKind::range(1.0, 100.0, 10.0, SliderScale::Linear)).popup_slider().unit_label("GiB"),
];
let values = Rc::new(RefCell::new(DialogFields::new()));
let shown = values.clone();
let mut fixture = Fixture::new(move |ui| {
let _ = ParamRows::new("Form", &params, Bind::bound(&mut *shown.borrow_mut())).show(ui);
});
fixture.room(Vec2::new(1280.0, 800.0)).settle();
for unit in ["kbps", "s", "ms", "msec", "MiB", "GiB"] {
let painted = fixture.texts().iter().filter(|text| text.text == unit && !text.elided && text.clip.contains_rect(text.rect)).count();
assert_eq!(painted, 1, "one visible {unit}");
}
for (label, typed) in [("Bitrate", "8000"), ("Sync offset", "250 ms"), ("Delay", "120ms")] {
let field = fixture.by_label(label).expect("the number field");
fixture.click(&field).settle();
fixture.key(Key::A, Modifiers::COMMAND).type_text(typed).key(Key::Tab, Modifiers::NONE).settle();
}
let held = values.borrow();
assert_eq!(held.number("bitrate"), Some(8000.0));
assert_eq!(held.number("offset"), Some(250.0), "the milliseconds row reads its spelling");
assert_eq!(held.number("delay"), Some(120.0), "a row with unit text still reads its kind's spelling");
}
#[trial]
fn length_rows_show_custom_unit_text_without_changing_their_readers() {
let lengths = craft_ui::runtime::env::LengthUnits::new(UnitKind::Points, UnitKind::Points, 72.0);
let doubled = craft_behavior::NumberCodec::new(craft_behavior::Reader::new().bare(2.0), 2);
let params = vec![
Param::number("plain", "Plain", 0.0, 1.0, 2).length(lengths).unit_label("length label"),
Param::number("coded", "Coded", 0.0, 1.0, 2).length(lengths).codec(doubled).unit_label("codec label"),
Param::number("hidden", "Hidden unit", 0.0, 1.0, 2).length(lengths).unit_label(""),
];
let values = Rc::new(RefCell::new(DialogFields::new()));
let mut fixture = rows(params, &values);
fixture.room(Vec2::new(1280.0, 800.0)).settle();
for unit in ["length label", "codec label"] {
assert!(fixture.texts().iter().any(|text| text.text == unit && !text.elided && text.clip.contains_rect(text.rect)), "{unit}");
}
assert!(!fixture.texts().iter().any(|text| text.text == "pt" && !text.elided));
for (label, typed) in [("Plain", "3pt"), ("Coded", "3"), ("Hidden unit", "3pt")] {
let field = fixture.by_label(label).expect("the length row");
fixture.click(&field).settle();
fixture.key(Key::A, Modifiers::COMMAND).type_text(typed).key(Key::Enter, Modifiers::NONE).settle();
}
let (plain, coded) = (values.borrow().number("plain"), values.borrow().number("coded"));
assert_eq!(plain, Some(3.0));
assert_eq!(values.borrow().number("hidden"), plain);
assert!(plain.zip(coded).is_some_and(|(plain, coded)| coded == 2.0 * plain), "{plain:?}, {coded:?}");
}
/// A count per inch shows `/in` after its number, apart in the field or in the number's own run in the inline look, and
/// a typed number or an edit of that run is read back as the count.
#[trial]
@@ -10,11 +10,11 @@ use craft_ui::patterns::preferences::{
GroupSpec, PageSpec, PrefValue, PreferencesDraft, PreferencesLayout, PreferencesModel, PreferencesPage, PreferencesState, PreferencesWindow,
PreferencesWords, RowKind, RowSpec,
};
use craft_ui::runtime::env::Env;
use craft_ui::runtime::env::{Env, UnitKind};
use craft_ui::runtime::words::CommonWords;
use craft_ui::testing::pointer::{moved, press, release};
use craft_ui::testing::{Fixture, trial};
use egui::Ui;
use egui::{Key, Modifiers, Ui, Vec2};
use std::cell::{Cell, RefCell};
use std::rc::Rc;
@@ -190,6 +190,66 @@ fn a_host_labelled_row_shows_its_rules_help_and_follows_its_enabled_state() {
assert!(fixture.tree().is_disabled_key(button.node), "the disabled rule disables the host's button");
}
/// Number rows with units: a counted kind, unit text, both, and a float with unit text. Every `set` is recorded.
#[derive(Default)]
struct Counted {
sets: Vec<(String, PrefValue)>,
}
impl PreferencesModel for Counted {
fn pages(&self) -> Vec<PageSpec<'_>> {
let rows = vec![
RowSpec::new("output.size", "Brush size", RowKind::int(24, 1..=64).counting(UnitKind::Pixels)),
RowSpec::new("output.bitrate", "Bitrate", RowKind::int(6000, 100..=200_000).unit_text("kbps")),
RowSpec::new("output.delay", "Delay", RowKind::int(250, 0..=2000).counting(UnitKind::Milliseconds).unit_text("msec")),
RowSpec::new("output.buffer", "Buffer", RowKind::float(1.5, 0.5..=64.0, 1).unit_text("GiB")),
];
vec![PageSpec::new("output", "Output", rows)]
}
fn set(&mut self, key: &str, value: PrefValue) {
self.sets.push((key.to_owned(), value));
}
fn custom_row(&mut self, _: &mut Ui, _: &str) -> bool {
false
}
fn custom_page(&mut self, _: &mut Ui, _: &str) -> bool {
false
}
fn reset_page(&mut self, _: &str) {}
}
/// An integer or number row shows its counted kind's symbol after the field, or its unit text when it counts no kind;
/// the counted kind wins over unit text, and reads the typed text.
#[trial]
fn number_rows_show_their_unit_or_unit_text_after_the_field() {
let counted = Rc::new(RefCell::new(Counted::default()));
let shown = Rc::clone(&counted);
let mut state = PreferencesState::default();
let mut fixture = Fixture::new(move |ui| {
PreferencesPage::new(Bind::bound(&mut state)).show(ui, &mut *shown.borrow_mut());
});
fixture.room(Vec2::new(1280.0, 800.0)).settle();
for (label, unit) in [("Brush size", "px"), ("Bitrate", "kbps"), ("Delay", "ms"), ("Buffer", "GiB")] {
let field = fixture.by_label(label).expect("the number field");
let painted = fixture
.texts()
.iter()
.filter(|text| text.text == unit && !text.elided && text.clip.contains_rect(text.rect) && field.rect.contains_rect(text.rect))
.count();
assert_eq!(painted, 1, "one visible {unit} on {label}");
}
assert!(!fixture.texts().iter().any(|text| text.text == "msec"), "the counted kind's symbol wins over unit text");
let field = fixture.by_label("Delay").expect("the delay field");
fixture.click(&field).settle();
fixture.key(Key::A, Modifiers::COMMAND).type_text("120ms").key(Key::Tab, Modifiers::NONE).settle();
let last = counted.borrow().sets.last().cloned();
assert_eq!(last, Some(("output.delay".to_owned(), PrefValue::Int(120))), "the counted kind reads the typed text");
}
struct Model {
side: String,
}
+1 -1
View File
@@ -4079,7 +4079,7 @@ One-shot screenshot slots and the facts a screenshot is measured against.
- `pub fn mode(mut self, mode: Mode) -> Self`. Resolves in `mode`: a plot that is dark in every theme, a preview of the other mode.
- `pub fn contrast(mut self, contrast: Contrast) -> Self`. Resolves under `contrast`.
- `pub fn density(mut self, density: Size) -> Self`. Resolves at the density preset `density`.
- `craft_ui::runtime::env::UnitKind`: `pub enum UnitKind { Pixels, Percent, Degrees, Points, Times, Inches, Centimetres, Millimetres, Picas, PixelsPerInch, PixelsPerCentimetre, Minutes, Columns, LinesPerInch, LinesPerCentimetre, Feet, Yards, Metres, Q, Ha, Letters, Hyphens }`. What a number counts.
- `craft_ui::runtime::env::UnitKind`: `pub enum UnitKind { Pixels, Percent, Degrees, Points, Times, Inches, Centimetres, Millimetres, Picas, PixelsPerInch, PixelsPerCentimetre, Minutes, Columns, LinesPerInch, LinesPerCentimetre, Feet, Yards, Metres, Q, Ha, Letters, Hyphens, PerInch, Milliseconds }`. What a number counts.
- `pub const LENGTHS: [UnitKind; 5]`. The lengths a unit choice offers. [`per_inch`](Self::per_inch) answers for more kinds (feet, yards, metres, Q,
- `pub const fn decimals(self) -> RangeInclusive<usize>`. The digits after the decimal mark a number of this kind shows by default, at most.
- `pub const fn step(self) -> f64`. What one arrow press, wheel notch or scrub point changes a number of this kind by, where the control that shows
+2 -2
View File
@@ -268,13 +268,13 @@ note = "The unit is a kind whose spelling comes from `Units` in the user's langu
type = "RowKind"
old = "RowKind::Int { value, range, unit }"
new = "RowKind::int(value, range).counting(kind)"
note = "Struct-like variants are `#[non_exhaustive]`; the unit is a `UnitKind`."
note = "Struct-like variants are `#[non_exhaustive]`; the unit is a `UnitKind`, or `.unit_text(text)` for a unit no `UnitKind` names."
[[setter]]
type = "RowKind"
old = "RowKind::Float { value, range, decimals, unit }"
new = "RowKind::float(value, range, decimals).counting(kind)"
note = "Struct-like variants are `#[non_exhaustive]`; the unit is a `UnitKind`."
note = "Struct-like variants are `#[non_exhaustive]`; the unit is a `UnitKind`, or `.unit_text(text)` for a unit no `UnitKind` names."
[[setter]]
type = "RowKind"