1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
//! # Livewire for Rust
//!
//! Livewire renders a component on the server, sends the browser a signed snapshot of its state,
//! and answers the browser's updates with new HTML and effects. This crate ports the server half of
//! Livewire 4.x to Laravel for Rust, and reuses Livewire's own browser runtime unchanged.
//!
//! A component is a Rust struct whose fields cross the wire, plus an inherent implementation that
//! publishes its actions:
//!
//! ```ignore
//! use livewire::{LivewireComponent, component};
//!
//! #[derive(Default, LivewireComponent)]
//! #[livewire(view = "livewire.counter")]
//! struct Counter {
//! count: i32,
//! #[livewire(locked)]
//! id: String,
//! }
//!
//! #[component]
//! impl Counter {
//! fn mount(&mut self, count: Option<i32>) {
//! self.count = count.unwrap_or(0);
//! self.id = livewire::str::random(20);
//! }
//!
//! fn increment(&mut self) {
//! self.count += 1;
//! }
//! }
//! ```
//!
//! The application registers its components once, in the provider:
//!
//! ```ignore
//! use livewire::LivewireServiceProvider;
//!
//! laravel::Application::configure().with_providers(|providers| {
//! providers.add(LivewireServiceProvider::new(|components| {
//! components.register::<Counter>("counter");
//! }));
//! });
//! ```
//!
//! A page renders a component with [`livewire`]; a component that should render the whole document
//! is mounted by its route with [`page::render_page`].
//!
//! | Module | Holds |
//! | --- | --- |
//! | [`mod@component`] | The authoring contract: [`Component`], [`LivewireState`], and the call envelope |
//! | [`snapshot`] | The signed wire envelope and its checksum |
//! | [`context`] | One request's mutable Livewire state, kept out of statics |
//! | [`engine`] | The `.livewire` template engine |
//! | [`registry`] | The components, synthesizers, and hooks an application registered |
extern crate self as livewire;
pub use ;
pub use LivewireConfig;
pub use LivewireServiceProvider;
pub use ComponentRegistry;
pub use ;
/// The items generated code names, which an application never writes.
pub use Result;
pub use LivewireError;
/// The string helpers the component IDs use, from the framework.
pub use str;