Crates.io | kle-serial |
lib.rs | kle-serial |
version | |
source | src |
created_at | 2023-07-15 00:28:59.748795 |
updated_at | 2024-12-07 17:40:39.331581 |
description | Rust deserialisation library for Keyboard Layout Editor JSON files |
homepage | |
repository | https://github.com/staticintlucas/kle-serial-rs |
max_upload_size | |
id | 916873 |
Cargo.toml error: | TOML parse error at line 24, column 1 | 24 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
A Rust library for deserialising Keyboard Layout Editor files.
Designed to be used in conjunction with serde_json
to deserialize JSON files exported from KLE.
use kle_serial::Keyboard; // Equivalent to kle_serial::Keyboard<f64> or kle_serial::f64::Keyboard
let keyboard: Keyboard = serde_json::from_str(
r#"[
{"name": "example"},
[{"f": 4}, "!\n1\n¹\n¡"]
]"#
).unwrap();
assert_eq!(keyboard.metadata.name, "example");
assert_eq!(keyboard.keys.len(), 1);
assert!(keyboard.keys[0].legends[0].is_some());
let legend = keyboard.keys[0].legends[0].as_ref().unwrap();
assert_eq!(legend.text, "!");
assert_eq!(legend.size, 4);
assert!(keyboard.keys[0].legends[1].is_none());
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.