← All Workshops

MudEngine Part 7: Save & Load

Step 6 / 17

Add dependencies

The server needs serde and toml to read Game.toml and to read/write Players.toml. The old Part 6 Cargo.toml didn't include them because room data was hardcoded.

Two more changes to the [dependencies] block compared to Part 6:

  • dioxus and dioxus-fullstack are pinned to 0.7.10 so they match the installed dx CLI exactly. The Dioxus tooling refuses to run (dx and dioxus versions are incompatible!) when the crate version and the CLI version differ. Bump both together when you update dx.
  • dioxus-primitives (added by dx components add in Part 5) is kept — the Button and Separator components still use it.

Add or replace the full [dependencies] block:

mud-engine/Cargo.toml
[package]
name = "mud-engine"
version = "0.1.0"
edition = "2024"

[dependencies]
dioxus = { version = "=0.7.10", features = ["fullstack"] }
dioxus-primitives = { git = "https://github.com/DioxusLabs/components", version = "0.0.1", default-features = false }
dioxus-fullstack = "=0.7.10"
serde = { version = "1", features = ["derive"] }
uuid = { version = "1", features = ["v4", "js"] }

# add these:
tokio = { version = "1", features = ["sync", "time"] }
toml = "1.1"
🎯 What changed
CratePurpose
serde with deriveAlready imported for WebSocket messages; now also used to deserialize/serialize the TOML file format
tomlDeserializes Game.toml and Players.toml; serializes Players.toml back when the autosave task runs
dioxus (=0.7.10)Pinned to match the dx CLI version — dx rejects mismatched versions
dioxus-primitivesKept from Part 5 — powers the styled Button and Separator components
tokio (sync + time)sync powers the broadcast channel; time provides interval() for the autosave task (added in the "Sync to disk" step)
uuid (v4 + js)Still used by mud_ws to generate player IDs. The js feature keeps uuid compiling for the wasm32-unknown-unknown client target — without it (or rng-getrandom / rng-rand) the web build fails

The serde dependency was already present in Part 6 for the WebSocket message types, so we're just adding toml. The derive feature is already enabled.

Step 6 / 17