cargo serde_derive 0.8.6

latest releases: 1.0.144, 1.0.143, 1.0.142...
7 years ago
  • Add a serde_derive crate which provides a Macros 1.1 implementation of #[derive(Serialize, Deserialize)] (#530)
  • Add serde_codegen::expand_str which is necessary for Macros 1.1

Using Macros 1.1 requires rustc support (not in nightly yet but available in rust-lang/rust#35957) and cargo support (available in rust-lang/cargo#3064). Using Macros 1.1 looks like this:

Cargo.toml

[dependencies]
serde = "0.8"
serde_derive = "0.8"

src/main.rs

#![feature(rustc_macro)]

#[macro_use]
extern crate serde_derive;

#[derive(Serialize, Deserialize)]
struct ItWorks {
    exciting: bool,
}

Advantages of this approach:

  • We expect Macros 1.1 to be stabilized much sooner than the features that serde_macros relies on, so we are finally in sight of having ergonomic Serde code generation available on stable Rust.
  • Even on nightly Rust, serde_derive is built in a way that is much more stable than serde_macros. It will not be affected by breaking libsyntax changes in the nightly compiler.

Don't miss a new serde_derive release

NewReleases is sending notifications on new releases.