| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 4 个月前 | ||
| 4 个月前 | ||
| 25 天前 | ||
| 4 个月前 |
Hello World (Rust)
A minimal example demonstrating RivetKit in Rust with a real-time counter shared across multiple clients. This is the Rust translation of the hello-world example.
Getting Started
git clone https://github.com/rivet-dev/rivet.git
cd rivet/examples/hello-world-rust
cargo build -p rivet-engine
RIVET_ENGINE_BINARY_PATH=../../target/debug/rivet-engine cargo run
See the Rust Quickstart for creating the actor and connecting clients.
Features
- Actor state management: Persistent counter state managed by Rivet Actors
- Real-time updates: Counter values synchronized across all connected clients via events
- Multiple actor instances: Each counter key creates a separate actor instance
- Typed Rust runtime: Built on the
rivetkitcrate'sActorandHandlestraits
Implementation
This example demonstrates the core RivetKit concepts with a simple counter:
- Actor Definition (
src/lib.rs): Acounteractor with persistent state, anincrementaction, and anewCountbroadcast event
Resources
Read more about actions, state, and events.
License
MIT