Crates.io | databoard |
lib.rs | databoard |
version | 0.1.0 |
created_at | 2025-09-09 13:25:29.099006+00 |
updated_at | 2025-09-18 09:29:00.052786+00 |
description | Provides a hierarchical key-value-store |
homepage | http://github.com/stepkun/databoard.git |
repository | https://github.com/stepkun/databoard.git |
max_upload_size | |
id | 1830835 |
size | 50,249 |
Implementation of a hierarchical key-value-store with the possibility to do a remapping from a level up to its parent level.
The following restrictions apply:
You can do the remapping either
For controlling the access in the hierarchy there are two kinds of special keys:
@
redirect to the top level databoard
of the hierarchy._
restrict the access to the curent databoard
.A standalone databoard:
use databoard::Databoard;
// instantiation of a default Databoard
let databoard = Databoard::new();
// setting a value returns a `Result` of the previous content, in this case a `None`.
let old = databoard.set("test", 42).unwrap();
// getting the value may fail, so it returns a `Result`,
let value = databoard.get::<i32>("test").unwrap();
// deleting the value returns a `Result` of the previous content, in this case `42`.
let value = databoard.delete::<i32>("test").unwrap();
Hierarchical usage:
use databoard::{Databoard, Remappings};
let top_level = Databoard::new();
// this creates a databoard with automatic remapping to parent
let level1 = Databoard::with_parent(top_level.clone());
// some remapping rules
let mut remappings = Remappings::default();
remappings.add("test", "{test}");
remappings.add("other_test", "{test}");
// this creates a databoard with manual remapping to parent using the defined remapping rules
let level2 = Databoard::with(Some(level1.clone()), Some(remappings), false);
// sets the value in the top `databoard`
top_level.set("test", 42).unwrap();
// but it can also be accessed from the two other levels
let value1: i32 = level1.get("test").unwrap();
let value2: i32 = level2.get("other_test").unwrap();
Licensed with the fair use "NGMC" license, see license file
Any contribution intentionally submitted for inclusion in the work by you, shall be licensed with the same "NGMC" license, without any additional terms or conditions.