-
Notifications
You must be signed in to change notification settings - Fork 83
use serde #128
Comments
You could use cargo features to facilitate people being able to choose. |
Correct me if I'm wrong, but I guess Docopt serializations will ever happen once at the very start of the process. Is gaining 2ms important enough to add dependencies, complexify the buid process (and code), and create two very different builds (nightly and beta/stable) with two different classes of bugs and maintenance burden ? |
I don't feel an urgency to use |
Issues like rust-lang-deprecated/rustc-serialize#128 make me really nervous relying on this. |
@nixpulvis That's not a bug in the serialization infrastructure. It's probably a bug in the JSON specific code. It doesn't affect Docopt. Consider this program: extern crate docopt;
extern crate rustc_serialize;
use docopt::Docopt;
const USAGE: &'static str = "
Usage: program [-x ARG -y ARG]
Options:
-x ARG
-y ARG
";
#[derive(Debug, RustcDecodable)]
struct Args {
flag_x: f64,
flag_y: f64,
}
fn main() {
let args: Args = Docopt::new(USAGE)
.and_then(|d| d.decode())
.unwrap_or_else(|e| e.exit());
println!("{:?}", args);
} If you try to invoke it without either
(This means that you must use |
I arrived here because I was also looking into optional settings with |
@SuperFluffy Could you please clarify? What is wrong with using |
It is only necessary for
I'd prefer if there was some consistency in this by either not having to wrap the |
@SuperFluffy OK, that does indeed look like a bug, but it's really not related to adding serde support to docopt, so I filed a new issue: #142 |
Now that the Macros 1.1 API that serde needs in order to avoid the awful codegen hacks is getting closer to being stabilised, is this something that can be looked at during the next few rustc release cycles? I'm currently planning to migrate one of my projects to serde as it's significantly more flexible and alas docopt is the only thing that will stop me from removing rustc_serialize altogether... |
It seems like serde and rustc-serialize can happily coexist, so I don't think this is going to be high on my priority list. With that said, I would like to eventually move docopt and csv to using serde. I just don't know when it's going to happen. |
Indeed they can - the fewer dependencies the better of course, but understandable if this takes some time :) |
Rustc-serialize is still used for docopt, which coexists happily along side serde, but I still plan to switch when docopt/docopt.rs#128 is resolved.
Cargo would like to migrate off of rustc-serialize - cc rust-lang/cargo#3682. |
The rustc-serialize crate has been deprecated: announcement. |
To give an update on this: I would certainly like this to happen, but I don't have any immediate plans to work on it myself. |
I should start using
serde
for the automatic serialization component of this crate.I don't think this means removing support for
rustc-serialize
just yet though.The text was updated successfully, but these errors were encountered: