Skip to main content

Module wire

Module wire 

Source

Structs§

LiveRegistry
WirePlugin
The two routes @wire(...) needs, bundled for larust_http::Router::plugin - sugar for the exact .get/.post pair this module’s own doc comment shows an app writing by hand today. Registration itself is still the app’s explicit choice (.plugin(WirePlugin) in routes/web.rs), this only removes the need to know or copy the two literal route strings.

Traits§

WireComponent
A server-state-backed reactive component - Larust’s Livewire-equivalent. Unlike Livewire, Self’s state never crosses the wire: it lives server-side, keyed by the user’s session (see larust-live::state), and only an opaque component id is ever sent to/from the browser.

Functions§

components
Starts building the process-wide wire-component registry. Call .register::<C>() for each component, then .publish() once, typically right before Application::serve() - same “build via fluent chain, then publish once” shape as larust_events::listeners()/ListenerRegistry.
mount
Mounts a fresh instance of the component registered as name, storing its initial state server-side (keyed by session) and returning the rendered <div data-wire-id="..."> wrapper - what a @wire(...) codegen call site splices directly into the surrounding page’s HTML.
runtime_js
GET /__larust_wire/runtime.js - the vendored client runtime, served from the installed larust-live crate itself (include_str!’d, not vendored into every scaffolded app’s public/js/) so it stays version-locked to the framework with zero drift/“forgot to re-copy after an upgrade” risk.
update
POST /__larust_wire/{component_id} - handles both a wire:model-style prop sync and a wire:click-style action call in one request (see UpdatePayload): every sync carries the component’s entire current wire:model field set, not a delta, which is what correctly threads a deferred field’s just-typed value through when a different element’s click/wire-sync is what actually triggers the request.