Make it harder to accidentally use private features
In particular if built with `--all-features` or `features = "all"` we don't want to accidentally make it look like `YearFlags` are something that people should use. So: hide it from docs and put it behind a dunder.
This commit is contained in:
parent
4f73f9423b
commit
5ca6ff5afc
|
@ -29,6 +29,7 @@ alloc = []
|
||||||
std = []
|
std = []
|
||||||
clock = ["time", "std"]
|
clock = ["time", "std"]
|
||||||
wasmbind = ["wasm-bindgen", "js-sys"]
|
wasmbind = ["wasm-bindgen", "js-sys"]
|
||||||
|
__internal_bench = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
time = { version = "0.1.39", optional = true }
|
time = { version = "0.1.39", optional = true }
|
||||||
|
|
|
@ -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