datastar/sdk/rust
Johnathan Stevers 93852fc1ad
Rust SDK framework integration + hello-world examples (#558)
* remove infinite scroll example

* add rocket and axum example

* rework how framework integration works

* rocket integration

* add .gitignore

* dont elide `retry`

* add "read signals" to rocket hello-world example

* don't elide `retry` in display

* remove mime dependency

* update cargo.toml

* add underscore to unused consts

* formatting

* use `async_stream` instead of "hand writing" streams

* add axum test

* fix errors

* implement custom sse stream for axum and rocket

* generate hello-world.html

* update readme

* don't track cargo.lock
2025-02-02 18:14:20 -06:00
..
src Rust SDK framework integration + hello-world examples (#558) 2025-02-02 18:14:20 -06:00
.gitignore Rust SDK framework integration + hello-world examples (#558) 2025-02-02 18:14:20 -06:00
Cargo.toml Rust SDK framework integration + hello-world examples (#558) 2025-02-02 18:14:20 -06:00
README.md Rust SDK framework integration + hello-world examples (#558) 2025-02-02 18:14:20 -06:00

README.md

Datastar Rust SDK

An implementation of the Datastar SDK in Rust with framework integration for Axum and Rocket.

Usage

use datastar::prelude::*;
use async_stream::stream;

Sse(stream! {
    // Merges HTML fragments into the DOM.
    yield MergeFragments::new("<div id='question'>What do you put in a toaster?</div>").into();

    // Merges signals into the signals.
    yield MergeSignals::new("{response: '', answer: 'bread'}").into();
})