Skip to content
This repository has been archived by the owner on Sep 24, 2020. It is now read-only.

Consider using extra::serialize::{Encoder,Decoder} #5

Open
erickt opened this issue Jan 8, 2014 · 2 comments
Open

Consider using extra::serialize::{Encoder,Decoder} #5

erickt opened this issue Jan 8, 2014 · 2 comments

Comments

@erickt
Copy link

erickt commented Jan 8, 2014

Nicely done! I was also thinking about making a toml parser. What do you think about adding support for users to leverage extra::serialize framework in order to simplify configuration? For example:

#[deriving(Encodable, Decodable)]
struct Def {
    a: ~str,
}

#[deriving(Encodable, Decodable)]
struct Abc {
    def: Def
}

#[deriving(Encodable, Decodable)]
struct Config {
    a: ~str,
    abc: Abc,
    products: ~[~str], 
}

fn main() {
    let decoder = toml::decoder(...);
    let value = Decodable::decode(&mut decoder);
    ...
}
@mneumann
Copy link
Owner

mneumann commented Jan 8, 2014

It's possible to do, as I did with msgpack :). Definitively I should give it a try.

@mneumann
Copy link
Owner

@erickt: I partially implemented decoding. See https://github.com/mneumann/rust-toml/blob/master/src/examples/decoder/main.rs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants