shelly-liveview 0.6.0

Core runtime primitives for Shelly LiveView.
Documentation

shelly-liveview

Core runtime primitives for Shelly LiveView.

This crate provides the server-authoritative runtime surface:

  • LiveView and LiveSession
  • protocol message types (ClientMessage, ServerMessage)
  • HTML/template primitives (Html, Template)
  • runtime context helpers (Context)
  • replay, pubsub, and telemetry contracts

It intentionally excludes HTTP/WebSocket transport details.

Install

cargo add shelly-liveview

Quick Example

use shelly::{Context, Event, Html, LiveResult, LiveView};

#[derive(Default)]
struct Counter {
    count: i64,
}

impl LiveView for Counter {
    fn handle_event(&mut self, event: Event, _ctx: &mut Context) -> LiveResult {
        if event.name == "inc" {
            self.count += 1;
        }
        Ok(())
    }

    fn render(&self) -> Html {
        Html::new(format!("<h1>{}</h1>", self.count))
    }
}

Related Crates

API Docs

https://docs.rs/shelly-liveview