Serializes/deserializes Rust data types to and from the filesystem.
So, this project is basically about mapping JSON/YAML/TOML kind of structures onto the filesystem. Why, would you ask? What is so bad about these formats that it warranted writing this library?
These formats are fine for what they were designed for... more or less. However, they have some shortcomings, especially when they are used in contexts such as configuration files. Let's list some of them:
Logically, the easiest way to access values from shell scripts is by reading a file in its entirety. So, what if we just serialized our data as a set of directories & files? This is how serde_fs was born.
This is an early version and API and the mappings might change before 1.0.
| Type | Mapping |
|-----------------------------|---------------------------------------------------------------------------|
| OptionNone
, target file if Some
|
| (u,i)(8,16,32,64), f(32,64) | String representation of the number |
| String/str | String itself |
| bool | "true" or "false" string |
| char | First character of the file |
| () | Empty file |
| tuple | Directory with files called 0
, 1
, .. |
| Map | Directory with files/directories called after their keys |
| struct | Same as map |
| unit variant | File with variant name |
| tuple variant | Directory with variant
file containing variant name, the rest as tuple |
| struct variant | Directory with variant
file containing variant name, the rest as struct |
This project uses SIT for managing and tracking issues independently from GitHub. You can find brief instructions on sending issue updates to this repository in its README.
serde_fs is distributed under the terms of both the MIT license and the Apache License (Version 2.0).
See LICENSE-APACHE and LICENSE-MIT for details.