serde_table
A macro for parsing tables into Rust structs.
use Deserialize;
use serde_table;
let people: = serde_table! .unwrap;
Installation
Add the following to your Cargo.toml:
[]
= "0.1.0"
Advanced Usage
While serde_table ought to do the right thing in general,
you can use serde_table_expr if you need to avoid the automatic quoting of bare variable-names (identifiers).
Why?
When you're writing tests, have you ever felt the desire to hide the data off in a file? Or switch to ron?
This is because modern programming is preoccupied with the individual, not the batch. Here's a before, 153 characters.
vec!
After, 88 characters. That is a 2x improvement in signal-to-noise.
let people: = serde_table! .unwrap;
How does it work?
You should read the (small) source for details, but the gist is that we translate what you wrote into a CSV string, then parse that with csv / serde. This can definitely be simplified, PRs welcome.