Merge pull request #374 from quodlibetor/fix-playground-and-docs
Change docs and playground features so that it compiles
This commit is contained in:
commit
d9d0728f51
|
@ -29,7 +29,7 @@ alloc = []
|
||||||
std = []
|
std = []
|
||||||
clock = ["time", "std"]
|
clock = ["time", "std"]
|
||||||
wasmbind = ["wasm-bindgen", "js-sys"]
|
wasmbind = ["wasm-bindgen", "js-sys"]
|
||||||
__internal_bench = ["criterion"]
|
__internal_bench = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
time = { version = "0.1.39", optional = true }
|
time = { version = "0.1.39", optional = true }
|
||||||
|
@ -37,8 +37,6 @@ num-integer = { version = "0.1.36", default-features = false }
|
||||||
num-traits = { version = "0.2", default-features = false }
|
num-traits = { version = "0.2", default-features = false }
|
||||||
rustc-serialize = { version = "0.3.20", optional = true }
|
rustc-serialize = { version = "0.3.20", optional = true }
|
||||||
serde = { version = "1.0.99", default-features = false, optional = true }
|
serde = { version = "1.0.99", default-features = false, optional = true }
|
||||||
# technically a dev-dependency, but they can't be optional
|
|
||||||
criterion = { version = "0.3", optional = true}
|
|
||||||
|
|
||||||
[target.'cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))))'.dependencies]
|
[target.'cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))))'.dependencies]
|
||||||
wasm-bindgen = { version = "0.2", optional = true }
|
wasm-bindgen = { version = "0.2", optional = true }
|
||||||
|
@ -49,16 +47,17 @@ serde_json = { version = "1", default-features = false }
|
||||||
serde_derive = { version = "1", default-features = false }
|
serde_derive = { version = "1", default-features = false }
|
||||||
bincode = { version = "0.8.0" }
|
bincode = { version = "0.8.0" }
|
||||||
num-iter = { version = "0.1.35", default-features = false }
|
num-iter = { version = "0.1.35", default-features = false }
|
||||||
|
criterion = { version = "0.3" }
|
||||||
doc-comment = "0.3"
|
doc-comment = "0.3"
|
||||||
|
|
||||||
[target.'cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))))'.dev-dependencies]
|
[target.'cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))))'.dev-dependencies]
|
||||||
wasm-bindgen-test = "0.2"
|
wasm-bindgen-test = "0.2"
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
all-features = true
|
features = ["serde"]
|
||||||
|
|
||||||
[package.metadata.playground]
|
[package.metadata.playground]
|
||||||
all-features = true
|
features = ["serde"]
|
||||||
|
|
||||||
[[bench]]
|
[[bench]]
|
||||||
name = "chrono"
|
name = "chrono"
|
||||||
|
|
|
@ -6,7 +6,7 @@ extern crate criterion;
|
||||||
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
||||||
|
|
||||||
use chrono::prelude::*;
|
use chrono::prelude::*;
|
||||||
use chrono::{Utc, FixedOffset, DateTime, YearFlags};
|
use chrono::{Utc, FixedOffset, DateTime, __BenchYearFlags};
|
||||||
|
|
||||||
fn bench_datetime_parse_from_rfc2822(c: &mut Criterion) {
|
fn bench_datetime_parse_from_rfc2822(c: &mut Criterion) {
|
||||||
c.bench_function("bench_datetime_parse_from_rfc2822", |b| {
|
c.bench_function("bench_datetime_parse_from_rfc2822", |b| {
|
||||||
|
@ -56,7 +56,7 @@ fn bench_year_flags_from_year(c: &mut Criterion) {
|
||||||
c.bench_function("bench_year_flags_from_year", |b|
|
c.bench_function("bench_year_flags_from_year", |b|
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
for year in -999i32..1000 {
|
for year in -999i32..1000 {
|
||||||
YearFlags::from_year(year);
|
__BenchYearFlags::from_year(year);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
10
src/lib.rs
10
src/lib.rs
|
@ -477,10 +477,7 @@ pub mod naive {
|
||||||
//! (e.g. [`TimeZone`](../offset/trait.TimeZone.html)),
|
//! (e.g. [`TimeZone`](../offset/trait.TimeZone.html)),
|
||||||
//! but can be also used for the simpler date and time handling.
|
//! but can be also used for the simpler date and time handling.
|
||||||
|
|
||||||
#[cfg(not(feature = "__internal_bench"))]
|
|
||||||
mod internals;
|
mod internals;
|
||||||
#[cfg(feature = "__internal_bench")]
|
|
||||||
pub mod internals;
|
|
||||||
mod date;
|
mod date;
|
||||||
mod isoweek;
|
mod isoweek;
|
||||||
mod time;
|
mod time;
|
||||||
|
@ -494,6 +491,10 @@ pub mod naive {
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
pub use self::datetime::rustc_serialize::TsSeconds;
|
pub use self::datetime::rustc_serialize::TsSeconds;
|
||||||
|
|
||||||
|
#[cfg(feature = "__internal_bench")]
|
||||||
|
#[doc(hidden)]
|
||||||
|
pub use self::internals::YearFlags as __BenchYearFlags;
|
||||||
|
|
||||||
|
|
||||||
/// Serialization/Deserialization of naive types in alternate formats
|
/// Serialization/Deserialization of naive types in alternate formats
|
||||||
///
|
///
|
||||||
|
@ -514,7 +515,8 @@ pub mod format;
|
||||||
mod round;
|
mod round;
|
||||||
|
|
||||||
#[cfg(feature = "__internal_bench")]
|
#[cfg(feature = "__internal_bench")]
|
||||||
pub use naive::internals::YearFlags;
|
#[doc(hidden)]
|
||||||
|
pub use naive::__BenchYearFlags;
|
||||||
|
|
||||||
/// Serialization/Deserialization in alternate formats
|
/// Serialization/Deserialization in alternate formats
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in New Issue