Wood is a very simple serialization datatype consisting of nested lists of strings
Termpose, Nakedlist, and Woodslist are text formats that parse into Wood.
The rust library currently has excellent support for termpose and woodslist.
```rust extern crate wood; use wood::{parse_woodslist, dewoodify};
fn main(){
let r:Vec
assert_eq!(2, r[2]); //easy as zero one two } ```
Although Wood's autoderive isn't as fully featured as serde's (maybe we should make a serde crate for it), it does exist and it does work.
```rust extern crate wood; extern crate woodderive; use wood::{parsetermpose, prettytermpose, Woodable, Dewoodable}; use woodderive::{Woodable, Dewoodable};
struct Dato { a:String, b:bool, }
fn main(){ let od = Dato{a:"chock".into(), b:true}; let s = pretty_termpose(&od.woodify());
assert_eq!("Dato a:chock b:true", &s);
let d = Dato::dewoodify(&parse_termpose(&s).unwrap()).unwrap();
assert_eq!(&od, &d); } ```
There are also these things called wooder combinators. I haven't found a way to make them really useful in rust for various reasons, but they'll be (usually) zero-sized values that you can assemble to specify a translation between wood and data (you usually explain both directions at once. I wanna call them "bifunctions").
I've made a start on Dewooder/Wooder combinators, for when you want to customize the parsing process.
```rust extern crate wood; extern crate woodderive; use wood::{wooder, Wood, Dewooder}; use woodderive::{Woodable, Dewoodable};
struct Datu {
name: String,
numbers: Vec
fn main(){ let data:Wood = wood::parsemultilinetermpose("
list entry 1 entry 2 sublist Datu name:n numbers(0 1 2) Datu name:nnn numbers(0 1 2) entry 3
").unwrap();
let sublist:&Wood = data.find("list").unwrap().find("sublist").unwrap();
let _:Vec