livewire-rust 0.1.3

Livewire for Rust: server-rendered reactive components for Laravel for Rust.
Documentation
//! # 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 mod assets;
pub mod checksum;
pub mod commands;
pub mod compile;
pub mod component;
pub mod config;
pub mod context;
pub mod engine;
pub mod error;
pub mod frontend;
pub mod handlers;
pub mod hooks;
pub mod html;
pub mod jinja_helpers;
#[cfg(feature = "database")]
pub mod models;
pub mod page;
pub mod persistent;
pub mod provider;
pub mod registry;
pub mod render;
pub mod routes;
pub mod session;
pub mod snapshot;
pub mod synthesizers;
pub mod testing;
pub mod uploads;

pub use self::component::{Call, Component, ComponentContext, ComponentView, LivewireState, Params};
pub use self::config::LivewireConfig;
pub use self::provider::LivewireServiceProvider;
pub use self::registry::ComponentRegistry;
pub use livewire_rust_macros::{LivewireComponent, component};

/// The items generated code names, which an application never writes.
#[doc(hidden)]
pub mod __private {
    pub use async_trait::async_trait;
    pub use serde_json;
    // The generated `validation_rules` builds these, in the consuming crate's name space.
    pub use laravel::validation::{Rule, Rules};
}
pub use self::component::Result;
pub use self::error::LivewireError;

/// The string helpers the component IDs use, from the framework.
pub use laravel::str;