serde-keyvalue-prim

Crates.ioserde-keyvalue-prim
lib.rsserde-keyvalue-prim
version0.1.2
created_at2026-01-04 01:39:33.248615+00
updated_at2026-01-09 18:25:18.84572+00
descriptionDeserialize key=value parameters with serde, supporting multiple delimiters, both key=value and key:value separated by either , or ;.
homepage
repositoryhttps://github.com/simonsso/serde-keyvalue-prim
max_upload_size
id2021143
size81,375
Fredrik Simonsson (simonsso)

documentation

https://docs.rs/serde-keyvalue-prim

README

serde-keyvalue-prim

A lightweight serde deserializer for strings containing key-value pairs separated by commas, as commonly found in command-line parameters or colon and semicolons as in simple line-based communication protocols.

Say your program takes a command-line option of the form:

--foo type=bar,active,nb_threads=8

or you need to parse a configuration string like:

type:bar;active:99;nb_threads=8

This crate provides a [from_key_values] function that deserializes these key-values into a configuration structure. Since it uses serde, the same configuration structure can also be created from any other supported source (such as a TOML or YAML configuration file) that uses the same keys.

The deserializer supports parsing signed and unsigned integers, booleans, strings (quoted or not), paths, and enums inside a top-level struct. The order in which the fields appear in the string is not important.

See also, source code documentation crates io

Acknowledgements

This project was forked from and source then modified to support multiple delimiters.

Commit count: 9

cargo fmt