Skip to content

v0.27.5

Choose a tag to compare

@W-Mai W-Mai released this 08 Jun 09:07
· 89 commits to main since this release
ae9f64c

mirui::gallery ships behind a new opt-in gallery feature: 40 demo
bodies live as pub fn build_widgets(world, parent) -> Entity plus an
optional setup_app(app, parent) -> Entity that brings the matching
plugins, themes, and SimTimelines. Any backend — desktop SDL, the
Linux fbdev / DRM paths, or the bare-metal ESP32-C3 build — can mount
the same demo widget tree by calling setup_app.

on body return semantics gain explicit shapes through a new
HandlerReturn trait: a body ending in () defaults to Prevent, a
trailing bool keeps the existing convention, and the new
BubbleControl::{Prevent, Allow} enum names the choice. The
underlying handler context aggregates world / entity / event
into a single HandlerCtx<'a, E> so handler bodies access fields
through ctx.world, ctx.entity, ctx.event. on EventKind(cb)
callback-form receives &mut HandlerCtx<E> accordingly.

Added

  • mirui::gallery module + gallery cargo feature — gated re-export of 40 widget-tree demos under mirui::gallery::demos::*. Each demo carries a build_widgets signature usable in no_std plus a setup_app helper available under feature = "std".
  • mirui::event::HandlerCtx<'a, E> — a &mut World, Entity, and &E aggregate that on body and callback handlers receive instead of three separate parameters.
  • mirui::event::HandlerReturn trait — implemented for () (returns Prevent), bool (current Prevent / Allow convention), and the new BubbleControl enum.
  • mirui::event::BubbleControl::{Prevent, Allow} — a named enum for on body returns; equivalent to returning true / false but reads at the call site.
  • gallery/examples/backends/ and gallery/examples/tools/ — backend-specific demos (compose_backend, linux_drm, linux_fb, sdl_gpu, sdl_smoke, wgpu_smoke, compose_backend_dsl) and developer tooling (perf_bench, perf_collect, snapshot regressions, widget_demo, zorder_baseline, hello_sdl, sim_input_demo, layout_demo) move to subdirectories with explicit [[example]] entries in gallery/Cargo.toml.
  • tests/gallery_demos.rs — 38 demos under one aggregate smoke plus dedicated custom_view_demo_smoke and widgets_demo_smoke for the registry-aware and viewport-aware paths.

Changed

  • on body context aggregation (BREAKING)__world, __entity, __event identifiers are gone. Handler bodies access state through ctx.world, ctx.entity, ctx.event instead.
  • on EventKind(cb) callback-form signature (BREAKING) — callbacks take &mut HandlerCtx<E> and return a HandlerReturn-compatible value, replacing the previous (world, entity, event) triple.
  • gallery/src/demos/ directory removed — every demo body that used to live there now resides at mirui::gallery::demos::xxx. The gallery::run runner stays in gallery/src/lib.rs; demos are imported from the mirui crate. linux_fb_demo and linux_drm_demo route through mirui::gallery::demos::hello::setup_app.
  • xtask cmd_lintxrune-fmt --check walks gallery/examples/ recursively so files under backends/ and tools/ stay in the format gate.

Internal

  • Demo bodies kept no_std + alloc-friendly: setup_app is cfg(feature = "std"), build_widgets is not. widgets::build_widgets takes (world, parent, view_w, view_h) so the host backend's display size flows through without a Setup parameter.
  • gallery/Cargo.toml enables mirui features ["quad-aa", "gallery"] so every cargo example sees the demos module.
  • xrune dependency stays at 1.5.2.