xref: /aosp_15_r20/external/crosvm/serde_keyvalue/README.md (revision bb4ee6a4ae7042d18b07a98463b9c8b875e44b39)
1*bb4ee6a4SAndroid Build Coastguard Worker# Serde deserializer from key=value strings
2*bb4ee6a4SAndroid Build Coastguard Worker
3*bb4ee6a4SAndroid Build Coastguard WorkerA lightweight serde deserializer for strings containing key-value pairs separated by commas, as
4*bb4ee6a4SAndroid Build Coastguard Workercommonly found in command-line parameters.
5*bb4ee6a4SAndroid Build Coastguard Worker
6*bb4ee6a4SAndroid Build Coastguard WorkerSay your program takes a command-line option of the form:
7*bb4ee6a4SAndroid Build Coastguard Worker
8*bb4ee6a4SAndroid Build Coastguard Worker```text
9*bb4ee6a4SAndroid Build Coastguard Worker--foo type=bar,active,nb_threads=8
10*bb4ee6a4SAndroid Build Coastguard Worker```
11*bb4ee6a4SAndroid Build Coastguard Worker
12*bb4ee6a4SAndroid Build Coastguard WorkerThis crate provides a `from_key_values` function that deserializes these key-values into a
13*bb4ee6a4SAndroid Build Coastguard Workerconfiguration structure. Since it uses serde, the same configuration structure can also be created
14*bb4ee6a4SAndroid Build Coastguard Workerfrom any other supported source (such as a TOML or YAML configuration file) that uses the same keys.
15*bb4ee6a4SAndroid Build Coastguard Worker
16*bb4ee6a4SAndroid Build Coastguard WorkerIntegration with the [argh](https://github.com/google/argh) command-line parser is also provided via
17*bb4ee6a4SAndroid Build Coastguard Workerthe `argh_derive` feature.
18*bb4ee6a4SAndroid Build Coastguard Worker
19*bb4ee6a4SAndroid Build Coastguard WorkerSee the inline documentation for examples and more details.
20