clauser

Crates.ioclauser
lib.rsclauser
version0.1.0
sourcesrc
created_at2024-06-25 02:09:02.525096
updated_at2024-06-25 02:09:02.525096
descriptionLibrary for parsing and deserializing Clausewitz files.
homepage
repositoryhttps://github.com/azrogers/clauser
max_upload_size
id1282904
size122,602
Ashley Rogers (azrogers)

documentation

README

clauser

crates.io badge docs.rs badge

clauser is a library for working with configuration, script, and data files from the Clausewitz engine used by Paradox Interactive for their grand strategy games.

It currently implements a Tokenizer, a low-level Reader, a serde-based Deserializer, and an copying Value deserializer for situations where serde won't work. For more information, read the documentation.

Examples

Using serde:

use serde::Deserialize;

#[derive(Deserialize)]
struct TestObject {
  a: i32,
  b: String,
  c: Date
}

let obj = clauser::de::from_str::<TestObject>(
  "a = 1 b = test c = 1940.1.1"
);
assert!(obj.a == 1);
assert!(obj.b == "test");
assert!(obj.c == Date::new(1940, 1, 1, 0));
Commit count: 19

cargo fmt