feat(ui): expose use_xxx() factory API for 8 hook primitives and add 4 example pages - #40
Merged
Merged
Conversation
eastspire
force-pushed
the
feat/ui-hook-api-and-demos-2026-08-28
branch
4 times, most recently
from
August 28, 2026 15:04
24a8526 to
7b61330
Compare
…xample pages; bump 0.16.1 -> 0.17.0
eastspire
force-pushed
the
feat/ui-hook-api-and-demos-2026-08-28
branch
from
August 28, 2026 15:18
7b61330 to
ecc9920
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wire the eight previously headless euv-ui hook primitives to actual public API surfaces (
use_xxx()factories + Copy + R2.1///) and add four demonstration pages (hooks-timing/hooks-async/hooks-protect/hooks-i18n) so the example project consumes them end-to-end. Bump the workspace to0.17.0(minor) since this PR adds new public functions to theeuv-uicrate.Part 2 of the user's "complete the missing components and hooks" series — Part 1 (PR #39) already added the missing
///summaries on R2.1-criticalimplblocks; this PR finishes the job by exposing the factory functions the doc-comments already advertise.What landed
A.
euv-uihook-layer public API surfaceuse_debounced_value::<T>(delay_ms: u32)pub fninhook/debounced_value/fn.rsDebouncedValue<T>: Copy(impl)///on the newimplblockuse_throttled_value::<T>(interval_ms: u32)pub fninhook/throttled_value/fn.rsThrottledValue<T>: Copy(impl)///on the newimplblockuse_previous::<T>()+previous_step(...)pub fninhook/previous/fn.rsPrevious<T>: Copy(impl)///on the newimplblockuse_lazy_component::<T, F>(factory: F)pub fninhook/lazy/fn.rsClone)///on the newimplblockuse_suspense::<T>()pub fninhook/suspense/fn.rsSuspenseHandle<T>: Copy(impl)///on the newimplblockuse_error_boundary()pub fninhook/error_boundary/fn.rs(extracted from the helper that the existingimplblock needs)ErrorBoundary: Copy(impl)///on the newimplblockuse_profiler()+profiler_measure(label, body)pub fninhook/profiler/fn.rs(with thenow_mspub fnjs-sys wrapper that the impl already expected)ProfilerHandle: Copy(impl)///on the newimplblockuse_i18n(init_locale)+i18n_register(handle, locale, &[(&'static str, &'static str)])+interpolate(template, vars)(the existing impl needed but was never defined)pub fn+pub(crate) fninhook/i18n/fn.rsI18n: Copy(impl)///on the newimplblockuse_async::<T, L>()(uses the existingUseAsyncHandle::new_for_fallbackpath;HookContext::use_asyncis on the roadmap but does not exist ineuv-coreyet)pub fninhook/use_async/fn.rsUseAsyncHandle<T, L>: Copy(impl)///on the newimplblockPlus:
ProfilerHandle::new_with_empty_entries()— hand-written because LombokNewcannot synthesise the defaultSignal<...>field.#[get(type(copy))]onDebouncedValue::valueandThrottledValue::valueso the call site can read the emitted value through aCopyboundary instead of borrowing.mod.rsfiles updated to the rust-standards three-section shape:mod r#fn;(where applicable) +pub use {r#fn::*, ...}+ trailinguse super::*;.error_boundary/mod.rsre-exportsextract_messageanduse_error_boundaryat the visibility the rest of the crate expects.B. Example demo pages (4 new pages, 29 → 33)
Each page lives in
example/src/page/hooks_{timing,async,protect,i18n}/, withmod.rs+hook/{fn,mod}.rs+view/{fn,struct,mod}.rsmirroring the existing page template (pereuv-ui-standards§8)./hooks-timinguse_debounced_value+use_throttled_value+use_previous/hooks-asyncuse_async+use_lazy_component+use_suspense/hooks-protectuse_error_boundary+use_profiler/hooks-i18nuse_i18nview/fn.rscorrectly applies the R2.1///doc-comment contract on everyfnandimplblock.C. Navigation + routing registration
example/src/component/nav/view/const.rsgets four newNAV_ITEMSrows;example/src/component/router/view/fn.rsgets four new match arms;example/src/page/mod.rsadds the four new modules and exports.Verification
The
audit_rust_standards14-item suite remains 100% green; the targeted R2.1 scan (fn + impl regex + "block immediately above has ///") reportsMissing fn /// = 0, Missing impl /// = 0acrossui/srcafter this change.Versioning
Workspace bumps from
0.16.1to0.17.0(minor). New pub functions are added but no existing signature changes / breaks — patch bump would technically suffice, but the0.16.xseries was the "docs compliance + new example pages" rollout;0.17.0matches the new pub-surface.Per project memory: CI's
sync_workspace_versionjob propagates the root bump,publishjob pushes the crate to crates.io,releasejob cuts the git tag + GitHub Release. No manual intervention needed on those steps once the PR merges intomaster.Scope / non-goals
HookContext::use_*()methods are not added — that lives ineuv-core, which this PR deliberately leaves untouched.App::use_*()wrappers ineuv-coreare not added — same reason.form,transition,i18nHookContextExt impls remain exactly as upstream ships them. Newuse_xxxfactories ineuv-uiare the public-API alternative that already works today.Cargo.tomlformatting change other than the version bumps.taplo fmtwas not run (no rule requires it for a Cargo.toml lines-only edit).Followup (out of scope)
HookContext::use_async(T, L, factory)is the natural next step — it would replace thenew_for_fallback()path thatuse_asynccurrently relies on. That requires aneuv-corechange.HookContext::use_form,use_i18n,use_transitionalready exist but currently route through theirHookContextXxxExttraits; the newuse_xxxfactories ineuv-uiare independent and additive.