@@ -72,6 +72,7 @@ If invalidations come in fast (or the transport drops/duplicates), the engine ai
7272| [ ` @statesync/svelte ` ] ( packages/svelte/ ) | Svelte snapshot applier adapter |
7373| [ ` @statesync/vue ` ] ( packages/vue/ ) | Vue (reactive/ref) snapshot applier adapter |
7474| [ ` @statesync/tauri ` ] ( packages/tauri/ ) | Tauri transport adapters (subscriber + provider) |
75+ | [ ` state-sync ` (Rust)] ( crates/state-sync/ ) | Shared protocol types for Rust backends (` Revision ` , ` SnapshotEnvelope<T> ` , ` InvalidationEvent ` ) |
7576
7677## Install
7778
@@ -249,14 +250,35 @@ pnpm build
249250
250251## Rust crate
251252
252- The ` crates/state-sync ` directory contains an experimental Rust crate.
253- It is ** not** part of the npm release and is versioned independently.
253+ The [ ` state-sync ` ] ( crates/state-sync/ ) Rust crate provides shared protocol types for Tauri (or any Rust) backends:
254+
255+ - ** ` Revision ` ** — monotonic ` u64 ` counter with saturating arithmetic
256+ - ** ` SnapshotEnvelope<T> ` ** — generic ` { revision, data } ` envelope (serde-ready)
257+ - ** ` InvalidationEvent ` ** — ` { topic, revision } ` change notification (serde-ready)
258+ - ** ` compare_revisions() ` ** — canonical ` u64 ` string comparison
259+
260+ ``` toml
261+ # src-tauri/Cargo.toml
262+ [dependencies ]
263+ state-sync = " 0.1"
264+ ```
265+
266+ ``` rust
267+ use state_sync :: {InvalidationEvent , Revision , SnapshotEnvelope };
268+
269+ let rev = Revision :: new (1 );
270+ let envelope = SnapshotEnvelope {
271+ revision : rev . to_string (),
272+ data : my_app_state ,
273+ };
274+ ```
275+
276+ The crate is versioned independently from the npm packages.
254277
255278``` bash
256279cd crates/state-sync
257- cargo fmt
258- cargo clippy --all-targets -- -D warnings
259280cargo test
281+ cargo clippy --all-targets -- -D warnings
260282```
261283
262284## License
0 commit comments