databoard
Implementation of a hierarchical key-value-store with the possibility to do a remapping from a level up to its parent level.
It supports both std and no_std environments (requires alloc).
The following restrictions apply:
- Each level can have exactly one parent.
- There is no remapping or access down the hierarchy.
- The remapping is evaluated recursively up the levels.
You can do the remapping either
- fully automatic,
- fully manual or
- do an automatic remapping with manual overrides.
For controlling the access in the hierarchy there are two kinds of special keys:
- keys prefixed with an
@redirect to the top leveldataboardof the hierarchy. - keys prefixed with an
_restrict the access to the currentdataboard.
Usage
A standalone databoard:
use *;
// instantiation of a default Databoard
let mut databoard = default;
// setting the value may fail, so it returns a `Result`,
let old = databoard.set.unwrap;
// getting the value may fail, so it returns a `Result`,
let value = databoard..unwrap;
// deleting the value returns a `Result` of the previous content.
let value = databoard.remove.unwrap;
Hierarchical usage:
use *;
let mut top_level = default;
// this creates a databoard with automatic remapping to parent
let mut level1 = with_parent;
// some remapping rules
let mut remappings = default;
remappings.add;
remappings.add;
// this creates a databoard with manual remapping to parent using the defined remapping rules
let level2 = with;
// sets the value in the top `databoard`
top_level.set.unwrap;
// but it can also be accessed from the two other levels
let value1: i32 = level1.get.unwrap;
let value2: i32 = level2.get.unwrap;
License
Licensed with the fair use "NGMC" license, see license file
Contribution
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.