Skip to main content

DynamicUpdateHub

Struct DynamicUpdateHub 

Source
pub struct DynamicUpdateHub { /* private fields */ }
Expand description

Shared cross-platform hub orchestrating surgical component-level and page-level dynamic updates.

Implementations§

Source§

impl DynamicUpdateHub

Atomic release-candidate application and live hot-update worker orchestration on DynamicUpdateHub.

Source

pub fn apply_prepared_release( &self, candidate: &PreparedReleaseCandidate, ) -> Result<usize, DynamicReleaseError>

Atomically applies all declarative and WASM page/component artifacts from a verified PreparedReleaseCandidate using default sandbox limits.

§Arguments
  • &Self - Target live dynamic update hub.
  • &PreparedReleaseCandidate - Verified, pre-warmed release candidate from UpdateWorkerHandle.
§Returns
  • Result<usize, DynamicReleaseError> - Number of pages and component slots atomically swapped.
Source

pub fn apply_prepared_release_with_sandbox( &self, candidate: &PreparedReleaseCandidate, sandbox_config: &WasmSandboxConfig, ) -> Result<usize, DynamicReleaseError>

Atomically applies all declarative and WASM page/component artifacts from a verified PreparedReleaseCandidate under sandbox_config.

§Arguments
  • &Self - Target live dynamic update hub.
  • &PreparedReleaseCandidate - Verified, pre-warmed release candidate.
  • &WasmSandboxConfig - Sandbox fuel and memory limits applied to warmed WASM modules.
§Returns
  • Result<usize, DynamicReleaseError> - Number of pages and component slots atomically swapped.
Source

pub fn sync_from_worker( &self, worker: &UpdateWorkerHandle, ) -> Result<Option<PreparedReleaseCandidate>, DynamicReleaseError>

Drains the newest verified release candidate from worker without blocking and atomically applies it into DynamicUpdateHub.

§Arguments
  • &Self - Target live dynamic update hub.
  • &UpdateWorkerHandle - Active background hot-update worker handle.
§Returns
  • Result<Option<PreparedReleaseCandidate>, DynamicReleaseError> - Applied candidate when a new release was ready, or None.
Source

pub fn needs_hot_update_poll(&self) -> bool

Returns true when the lock-free hot-update attention flag indicates a queued candidate or state change.

Executes as a single AtomicBool::load with zero RefCell borrows, zero mutex locks, and zero allocations.

§Returns
  • bool - true only when poll_hot_updates_at_safe_boundary has work to drain.
Source

pub fn hot_update_status_signal(&self) -> Signal<HotUpdateLiveStatus>

Returns the reactive Signal<HotUpdateLiveStatus> tracking live OTA connection state, active release sequence, and diagnostics.

§Arguments
  • &Self - Hub reference.
§Returns
  • Signal<HotUpdateLiveStatus> - Live hot-update status signal.
Source

pub fn update_hot_update_status(&self, status: HotUpdateLiveStatus)

Replaces the published HotUpdateLiveStatus snapshot (used by both native worker polling and wasm32 browser EventSource transport).

§Arguments
  • &Self - Hub reference.
  • HotUpdateLiveStatus - Updated live status snapshot.
Source

pub fn is_hot_updates_connected(&self) -> bool

Returns true when a live background worker or browser EventSource hot-update session is currently connected.

§Arguments
  • &Self - Hub reference.
§Returns
  • bool - Whether live hot updates are connected.
Source

pub fn has_pending_hot_update(&self) -> bool

Returns true when a prepared or safe-boundary-deferred hot-update candidate is waiting to be applied.

§Arguments
  • &Self - Hub reference.
§Returns
  • bool - Whether at least one verified candidate is queued.
Source

pub fn restore_cached_hot_updates( &self, config: &UpdateClientConfig, ) -> Result<Option<PreparedReleaseCandidate>, DynamicReleaseError>

Restores and atomically applies any verified cached release persisted under config.cache_dir (offline cold-start recovery).

§Arguments
  • &Self - Target live dynamic update hub.
  • &UpdateClientConfig - Client verification key, ABI, delivery mode, and cache_dir.
§Returns
  • Result<Option<PreparedReleaseCandidate>, DynamicReleaseError> - Applied cached release when present, or None.
Source

pub fn connect_hot_updates( &self, config: UpdateClientConfig, ) -> Result<(), DynamicReleaseError>

Starts (or reconnects) the hub-managed background UpdateWorker so App::step_frame() automatically applies incoming verified OTA releases.

§Arguments
  • &Self - Hub reference.
  • UpdateClientConfig - Server, proxy, verification key, delivery mode, sandbox, and cache settings.
§Returns
  • Result<(), DynamicReleaseError> - Ok(()) when the background worker started cleanly.
Source

pub fn disconnect_hot_updates(&self)

Stops any active hub-managed hot-update worker and clears deferred candidates cleanly.

§Arguments
  • &Self - Hub reference.
Source

pub fn request_hot_update_reconcile(&self) -> bool

Requests an immediate manifest reconciliation on the hub-managed background hot-update worker.

§Arguments
  • &Self - Hub reference.
§Returns
  • bool - true when an active worker received the reconcile request.
Source

pub fn poll_hot_updates_at_safe_boundary( &self, boundary: &InteractionSafePoint, ) -> Result<Option<PreparedReleaseCandidate>, DynamicReleaseError>

Non-blockingly drains the hub-managed hot-update mailbox (or a previously deferred candidate) and applies it atomically when boundary is safe.

§Arguments
  • &Self - Hub reference.
  • &InteractionSafePoint - Current frame-boundary safety probe.
§Returns
  • Result<Option<PreparedReleaseCandidate>, DynamicReleaseError> - Applied candidate when swapped on this frame, or None when idle/deferred.
Source§

impl DynamicUpdateHub

Component-level, page-level, and atomic bundle dynamic update orchestration on DynamicUpdateHub.

Source

pub fn new() -> Self

Creates a new DynamicUpdateHub with empty component/page registries and zero telemetry.

§Returns
  • Self - Shared dynamic update hub handle.
Source

pub fn apply_component( &self, update: DynamicComponentUpdate, ) -> Result<u64, DynamicUpdateError>

Applies a validated component-level dynamic update and surgically re-renders only that component slot.

§Arguments
  • &Self - Hub reference.
  • DynamicComponentUpdate - Incoming versioned component update.
§Returns
  • Result<u64, DynamicUpdateError> - Newly active component version on success.
Source

pub fn apply_component_json( &self, json: &str, ) -> Result<u64, DynamicUpdateError>

Parses and applies a JSON-encoded component-level dynamic update manifest.

§Arguments
  • &Self - Hub reference.
  • &str - JSON string encoding a DynamicComponentUpdate.
§Returns
  • Result<u64, DynamicUpdateError> - Newly active component version on success.
Source

pub fn swap_component_builder<CallbackFn>( &self, id: String, version: u64, builder: CallbackFn, ) -> Result<u64, DynamicUpdateError>
where CallbackFn: Fn() -> NodeId + 'static,

Hot-swaps a component slot with a native Rust builder closure without rebuilding sibling UI.

§Arguments
  • &Self - Hub reference.
  • String - Target component slot ID.
  • u64 - Monotonic version number.
  • CallbackFn - Zero-context native Rust UI builder closure.
§Returns
  • Result<u64, DynamicUpdateError> - Newly active component version on success.
Source

pub fn rollback_component(&self, id: &str) -> Result<u64, DynamicUpdateError>

Rolls back a component slot to its previous revision (or 0 compiled fallback when the stack empties).

§Arguments
  • &Self - Hub reference.
  • &str - Target component slot ID.
§Returns
  • Result<u64, DynamicUpdateError> - Restored active version (0 means compiled fallback).
Source

pub fn apply_page( &self, update: DynamicPageUpdate, ) -> Result<u64, DynamicUpdateError>

Applies a validated page-level dynamic update (overriding an existing route or injecting a new one).

§Arguments
  • &Self - Hub reference.
  • DynamicPageUpdate - Incoming versioned page update.
§Returns
  • Result<u64, DynamicUpdateError> - Newly active page version on success.
Source

pub fn apply_page_json(&self, json: &str) -> Result<u64, DynamicUpdateError>

Parses and applies a JSON-encoded page-level dynamic update manifest.

§Arguments
  • &Self - Hub reference.
  • &str - JSON string encoding a DynamicPageUpdate.
§Returns
  • Result<u64, DynamicUpdateError> - Newly active page version on success.
Source

pub fn swap_page_builder<CallbackFn>( &self, route: String, title: String, version: u64, builder: CallbackFn, ) -> Result<u64, DynamicUpdateError>
where CallbackFn: Fn() -> NodeId + 'static,

Hot-swaps a page route with a native Rust page builder closure.

§Arguments
  • &Self - Hub reference.
  • String - Target route path.
  • String - Page title.
  • u64 - Monotonic page version number.
  • CallbackFn - Zero-context native Rust page builder closure.
§Returns
  • Result<u64, DynamicUpdateError> - Newly active page version on success.
Source

pub fn rollback_page(&self, route: &str) -> Result<u64, DynamicUpdateError>

Rolls back a dynamically updated page to its previous revision (or 0 compiled fallback).

§Arguments
  • &Self - Hub reference.
  • &str - Target route path.
§Returns
  • Result<u64, DynamicUpdateError> - Restored page version (0 means fallback / removed).
Source

pub fn apply_bundle( &self, bundle: DynamicUpdateBundle, ) -> Result<DynamicTelemetry, DynamicUpdateError>

Validates all component and page entries in bundle before committing them atomically in a single batch.

§Arguments
  • &Self - Hub reference.
  • DynamicUpdateBundle - Multi-target atomic release bundle.
§Returns
  • Result<DynamicTelemetry, DynamicUpdateError> - Updated telemetry snapshot on full commit, or error with zero partial mutation.
Source

pub fn apply_bundle_json( &self, json: &str, ) -> Result<DynamicTelemetry, DynamicUpdateError>

Parses and atomically applies a JSON-encoded DynamicUpdateBundle manifest.

§Arguments
  • &Self - Hub reference.
  • &str - JSON bundle manifest string.
§Returns
  • Result<DynamicTelemetry, DynamicUpdateError> - Updated telemetry snapshot on success.
Source

pub fn on_action<CallbackFn>(&self, handler: CallbackFn)
where CallbackFn: FnMut(&DynamicActionEvent) + 'static,

Registers an action callback invoked whenever a button inside a dynamically updated component or page is clicked.

§Arguments
  • &Self - Hub reference.
  • CallbackFn - Action callback receiving &DynamicActionEvent.
Source

pub fn dispatch_action(&self, event: DynamicActionEvent)

Dispatches a DynamicActionEvent to all registered handlers and updates last_action + telemetry.

§Arguments
  • &Self - Hub reference.
  • DynamicActionEvent - Action event emitted by a dynamic control.
Source

pub fn component_revision_signal(&self, id: &str) -> Signal<u64>

Returns the dedicated reactive revision signal for component slot id.

§Arguments
  • &Self - Hub reference.
  • &str - Component slot identifier.
§Returns
  • Signal<u64> - Surgical revision signal bumped only when id updates.
Source

pub fn page_revision_signal(&self, route: &str) -> Signal<u64>

Returns the dedicated reactive revision signal for page route.

§Arguments
  • &Self - Hub reference.
  • &str - Target route path.
§Returns
  • Signal<u64> - Surgical revision signal bumped only when route updates.
Source

pub fn component_version(&self, id: &str) -> u64

Returns the currently active dynamic version for component slot id (0 means compiled fallback).

§Arguments
  • &Self - Hub reference.
  • &str - Component slot identifier.
§Returns
  • u64 - Active component version.
Source

pub fn component_history_len(&self, id: &str) -> usize

Returns the number of stacked dynamic revisions retained for component slot id.

§Arguments
  • &Self - Hub reference.
  • &str - Component slot identifier.
§Returns
  • usize - Number of revisions on the rollback stack.
Source

pub fn page_version(&self, route: &str) -> u64

Returns the currently active dynamic version for page route (0 means compiled fallback).

§Arguments
  • &Self - Hub reference.
  • &str - Page route path.
§Returns
  • u64 - Active page version.
Source

pub fn page_title(&self, route: &str) -> Option<String>

Returns the active dynamic page title for route if a dynamic page is mounted for it.

§Arguments
  • &Self - Hub reference.
  • &str - Page route path.
§Returns
  • Option<String> - Active dynamic page title if any.
Source

pub fn has_dynamic_page(&self, route: &str) -> bool

Returns true when route currently has an active dynamic page override or injected page.

§Arguments
  • &Self - Hub reference.
  • &str - Page route path.
§Returns
  • bool - True when a dynamic page payload is active for route.
Source

pub fn registered_routes(&self) -> Vec<String>

Returns the sorted list of all routes currently carrying active dynamic page payloads.

§Arguments
  • &Self - Hub reference.
§Returns
  • Vec<String> - Sorted active dynamic route paths.
Source

pub fn routes_signal(&self) -> Signal<u64>

Returns the reactive signal bumped whenever dynamic routes are added or removed.

§Arguments
  • &Self - Hub reference.
§Returns
  • Signal<u64> - Reactive route-set revision signal.
Source

pub fn telemetry(&self) -> Signal<DynamicTelemetry>

Returns the reactive telemetry snapshot signal.

§Arguments
  • &Self - Hub reference.
§Returns
  • Signal<DynamicTelemetry> - Reactive dynamic update telemetry signal.
Source

pub fn last_action(&self) -> Signal<Option<DynamicActionEvent>>

Returns the reactive signal storing the most recently dispatched DynamicActionEvent.

§Arguments
  • &Self - Hub reference.
§Returns
  • Signal<Option<DynamicActionEvent>> - Reactive latest action signal.
Source

pub fn mount_component_or_fallback( &self, id: &str, node_id: &DynamicSlotFallback, ) -> NodeId

Mounts the active dynamic payload for component slot id, or executes fallback if none is active.

§Arguments
  • &Self - Hub reference.
  • &str - Component slot identifier.
  • &DynamicSlotFallback - Compiled fallback builder closure.
§Returns
  • NodeId - Mounted native scene node handle.
Source

pub fn mount_page_or_fallback( &self, route: &str, fallback: &DynamicSlotFallback, ) -> NodeId

Mounts the active dynamic payload for page route, or executes fallback if none is active.

§Arguments
  • &Self - Hub reference.
  • &str - Target route path.
  • &DynamicSlotFallback - Compiled fallback page builder closure.
§Returns
  • NodeId - Mounted native page node handle.

Trait Implementations§

Source§

impl Clone for DynamicUpdateHub

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DynamicUpdateHub

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the struct fields as a debug struct, skipping excluded fields.

§Arguments
  • &mut ::std::fmt::Formatter<'_> - The formatter to write the representation into.
§Returns
  • ::std::fmt::Result - Success or failure of the formatting operation.
Source§

impl Default for DynamicUpdateHub

Default empty DynamicUpdateHub.

Source§

fn default() -> Self

Creates an empty DynamicUpdateHub backed by fresh reactive signals.

§Returns
  • Self - Initialized hub.

Auto Trait Implementations§

§

impl !RefUnwindSafe for DynamicUpdateHub

§

impl !Send for DynamicUpdateHub

§

impl !Sync for DynamicUpdateHub

§

impl !UnwindSafe for DynamicUpdateHub

§

impl Forget for DynamicUpdateHub

§

impl Freeze for DynamicUpdateHub
where *const RcInner<RefCell<DynamicHubState>> is !null: Freeze, PhantomData<RcInner<RefCell<DynamicHubState>>>: Freeze, *const ArcInner<Atomic<bool>> is !null: Freeze, PhantomData<ArcInner<Atomic<bool>>>: Freeze,

§

impl Move for DynamicUpdateHub

§

impl Unpin for DynamicUpdateHub
where Rc<RefCell<DynamicHubState>>: Unpin, Arc<Atomic<bool>>: Unpin,

§

impl UnsafeUnpin for DynamicUpdateHub
where *const RcInner<RefCell<DynamicHubState>> is !null: UnsafeUnpin, PhantomData<RcInner<RefCell<DynamicHubState>>>: UnsafeUnpin, *const ArcInner<Atomic<bool>> is !null: UnsafeUnpin, PhantomData<ArcInner<Atomic<bool>>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.