anza 0.6.0

Ultra-lightweight, zero-copy, cryptographically verified Server-Templated UI (STUI) engine
Documentation
1
2
3
4
5
6
7
8
9
10
11
#[cfg(feature = "axum")]
use {
  crate::models::envelope::Envelope,
  axum::response::sse::Event,
};

#[cfg(feature = "axum")]
pub fn event(envelope: Envelope) -> Result<Event, axum::Error> {
  let json = serde_json::to_string(&envelope).map_err(|e| axum::Error::new(e))?;
  Ok(Event::default().event("template").data(json))
}