UI 0.7.0 migration
Version 0.7.0 replaces chart and custom-widget construction. Upgrade direct
rs_lvgl, rs_lvgl_sys, rs_lvgl_codegen and rs_lvgl_ui dependencies together
where present. Migrate callers to the single new interface for each widget.
The native provider remains vendored LVGL 9.6. Default features and the existing explicit units, Flex alignment and widget-part names remain available. Projects coming from 0.5.0 or earlier should first apply the historical 0.6.0 migration.
Replace chart descriptions
Choose an explicit X range even for a chart using sample slots. Line, Bar,
Stacked and Curve use Y samples; Scatter uses XY samples. Curve requires the
effective native LV_USE_VECTOR_GRAPHIC capability. ChartValue::Missing
represents a gap; i32::MAX is reserved. Duplicate IDs, invalid ranges,
inconsistent lengths and incompatible sample kinds reject the render before
native mutation. Bar requires complete samples; Stacked also rejects negative
values, mixed Y axes and cumulative overflow.
For streaming data, keep ChartHistory in application state and pass
ChartData::History(history.snapshot()). History has an explicit epoch,
nonzero capacity and sample kind. Shift and Circular choose displayed ordering.
Appends require matching metadata and retained overlap; gaps, changed capacity,
replacement and remount recover by full synchronization. Snapshot creation copies
retained data; compare costs with the application's batch size rather than
assuming a frame-rate improvement. A ChartCursor uses its own stable ID and a
pixel or series/point target.
Use controlled range and text input
range_slider(min, max, SliderRange::new(lower, upper)) emits both endpoints
through on_range_changed. Typed construction also accepts binding.
Unordered or out-of-domain endpoints reject; the constructor does not sort or
clamp them. An ignored edit is restored from the model on reconciliation.
Textarea modifiers configure editing: accepted_chars,
input_max_length(Option<NonZeroU32>), cursor_position(Option<u32>) and
cursor_click_position(bool). Lengths and cursor positions count Unicode scalar
values. None removes the length limit; there is no zero-length-limit sentinel.
The application model remains authoritative: filters do not truncate the full
model string during reconciliation. Manual WidgetKind::Textarea literals must
supply the new input: Option<Box<TextareaInputOptions>> field; prefer builders
for the opaque settings.
Flex .flex_wrap(bool) and .flex_reverse(bool) select native flow independently.
Stable keys and descriptor child order retain their meaning. This complete view
fragment compiles against the pinned 0.7.0 source:
Enable the matching widget-slider, widget-textarea and widget-chart features
when disabling defaults. The native compiler validates this example; the online
Playground interpreter supports a smaller Rust subset.
Deliver custom properties explicitly
Implement apply_props even for Props = (). Pure validate runs before either
main or overlay mutates. A matching key and concrete type retains the widget;
changing either replaces it. Ui::tick advances only tick.
A successful property application must retire native references to previous
properties. If application partially fails, old and incoming properties remain
alive until native deletion completes. delete runs once while the root is live;
it retires external registrations and must not delete the root or reenter Ui.
A failed create cleans up its own partial construction. Native callbacks must
not unwind across C. The raw pointer and teardown contracts remain in force.
Verify the upgraded application
Run native tests serially, check disabled widget/layout configurations and
no_std where used, and exercise accepted/rejected input plus custom deletion on
the actual target. The website runs check-development-ui against its pinned
release, including both examples above and old-signature rejection controls.
For a complete native memory-display program and detailed limits, see
capability-depth.rs
and the capability guide.