serde-kv
serde-kv is a serde data format implementation
for a basic key/value string.
The format is a space-separated list of key=value pairs. Values are bare tokens,
or double-quoted when they contain spaces or special characters:
foo=bar baz=42 cool=true message="hello world"
There is no type inference at the format level — the type comes from the target
struct field. A raw token like 42 becomes the string "42" for a String field,
or the integer 42 for a u64 field. Quotes are purely for parsing, so
foo=42 and foo="42" decode to the same value.
Example
use ;
You can also deserialize into a map, where every value is a string:
use HashMap;
let map: =
from_str.unwrap;
assert_eq!;
Supported types
- Flat scalars:
String, all integer/float widths,bool,char. Option<T>: a missing key deserializes toNone;Noneis skipped when serializing.- Unknown keys are ignored, or collected with
#[serde(flatten)] extra: HashMap<String, String>.
Nested structs and sequences are not supported.