Store program/save files in a unique folder (.filestronghold-rs/
) across operating systems.
Add the following to your Cargo.toml:
toml
[dependencies]
stronghold = "0.1"
serde = "1.0"
serde_derive = "1.0"
This program saves a file under a folder titled with the crates name, and then opens it back up again to make sure it is the same:
```rust use stronghold::*;
extern crate serde_derive;
struct Data { x: u32, y: u32, text: String, }
fn main() { let data: Data = Data { x: 0, y: 0, text: "Hello, world!".tostring() }; let info = save!("savefile", data).unwrap(); println!("Saved: {:?}", info); let file: Data = load!("savefile").unwrap(); asserteq!(data, file); } ```
miniz_oxide
).