serde/lib.rs
1//! **DEPRECATED**: Since Rust 1.31 it's possible to
2//! [rename dependencies](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#renaming-dependencies-in-cargotoml).
3//! There is no need to use this crate anymore.
4//!
5//! A hack to allow having a feature named `serde` which doesn't just depend on serde
6//!
7//! In Cargo.toml, you can do the following:
8//!
9//! ```toml
10//! [dependencies]
11//! serde-feature-hack = { version = "0.1.0", optional = true }
12//!
13//! [features]
14//! serde = ["serde-feature-hack", "some-other-dependency"]
15//! ```
16//!
17//! Then, you can use `serde` like you normally would.
18//!
19//! ```
20//! extern crate serde;
21//! extern crate serde_json;
22//!
23//! use serde::{Serialize, Serializer};
24//!
25//! struct X;
26//!
27//! impl Serialize for X {
28//! fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
29//! serializer.serialize_str("Hello, world!")
30//! }
31//! }
32//!
33//! assert_eq!(serde_json::to_string(&X).unwrap(), r#""Hello, world!""#);
34//! ```
35
36#![no_std]
37
38pub use real_serde::*;