#![cfg_attr(rustbuild, feature(staged_api, rustc_private))]
#![cfg_attr(rustbuild, unstable(feature = "rustc_private", issue = "27812"))]
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://www.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/rustc-serialize/")]
#![cfg_attr(test, deny(warnings))]
#![allow(trivial_numeric_casts)]
#![cfg_attr(rust_build, feature(staged_api))]
#![cfg_attr(rust_build, staged_api)]
#![cfg_attr(rust_build,
unstable(feature = "rustc_private",
reason = "use the crates.io `rustc-serialize` library instead"))]
#[cfg(test)] extern crate rand;
pub use self::serialize::{Decoder, Encoder, Decodable, Encodable,
DecoderHelpers, EncoderHelpers};
fn cap_capacity<T>(given_len: usize) -> usize {
use std::cmp::min;
use std::mem::size_of;
const PRE_ALLOCATE_CAP: usize = 0x100000;
match size_of::<T>() {
0 => min(given_len, PRE_ALLOCATE_CAP),
n => min(given_len, PRE_ALLOCATE_CAP / n)
}
}
mod serialize;
mod collection_impls;
pub mod base64;
pub mod hex;
pub mod json;
mod rustc_serialize {
pub use serialize::*;
}