mirror of
https://github.com/chronotope/chrono.git
synced 2025-09-27 13:01:37 +00:00
Switch docs.rs to auto_docs_cfg
This commit is contained in:
parent
c4fc4c4b75
commit
7d2c9fc3f8
@ -334,7 +334,6 @@ where
|
||||
{
|
||||
/// Formats the date with the specified formatting items.
|
||||
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "std"))))]
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn format_with_items<'a, I, B>(&self, items: I) -> DelayedFormat<I>
|
||||
@ -349,7 +348,6 @@ where
|
||||
/// See the [`crate::format::strftime`] module
|
||||
/// on the supported escape sequences.
|
||||
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "std"))))]
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn format<'a>(&self, fmt: &'a str) -> DelayedFormat<StrftimeItems<'a>> {
|
||||
@ -358,7 +356,6 @@ where
|
||||
|
||||
/// Formats the date with the specified formatting items and locale.
|
||||
#[cfg(feature = "unstable-locales")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-locales")))]
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn format_localized_with_items<'a, I, B>(
|
||||
@ -383,7 +380,6 @@ where
|
||||
/// See the [`crate::format::strftime`] module
|
||||
/// on the supported escape sequences.
|
||||
#[cfg(feature = "unstable-locales")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-locales")))]
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn format_localized<'a>(
|
||||
|
@ -537,7 +537,6 @@ impl<Tz: TimeZone> DateTime<Tz> {
|
||||
/// Panics if the date can not be represented in this format: the year may not be negative and
|
||||
/// can not have more than 4 digits.
|
||||
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "std"))))]
|
||||
#[must_use]
|
||||
pub fn to_rfc2822(&self) -> String {
|
||||
let mut result = String::with_capacity(32);
|
||||
@ -548,7 +547,6 @@ impl<Tz: TimeZone> DateTime<Tz> {
|
||||
|
||||
/// Returns an RFC 3339 and ISO 8601 date and time string such as `1996-12-19T16:39:57-08:00`.
|
||||
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "std"))))]
|
||||
#[must_use]
|
||||
pub fn to_rfc3339(&self) -> String {
|
||||
// For some reason a string with a capacity less than 32 is ca 20% slower when benchmarking.
|
||||
@ -585,7 +583,6 @@ impl<Tz: TimeZone> DateTime<Tz> {
|
||||
/// "2018-01-26T10:30:09+08:00");
|
||||
/// ```
|
||||
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "std"))))]
|
||||
#[must_use]
|
||||
pub fn to_rfc3339_opts(&self, secform: SecondsFormat, use_z: bool) -> String {
|
||||
let mut result = String::with_capacity(38);
|
||||
@ -647,7 +644,6 @@ impl Default for DateTime<Utc> {
|
||||
}
|
||||
|
||||
#[cfg(feature = "clock")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "clock")))]
|
||||
impl Default for DateTime<Local> {
|
||||
fn default() -> Self {
|
||||
Local.from_utc_datetime(&NaiveDateTime::default())
|
||||
@ -673,7 +669,6 @@ impl From<DateTime<Utc>> for DateTime<FixedOffset> {
|
||||
|
||||
/// Convert a `DateTime<Utc>` instance into a `DateTime<Local>` instance.
|
||||
#[cfg(feature = "clock")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "clock")))]
|
||||
impl From<DateTime<Utc>> for DateTime<Local> {
|
||||
/// Convert this `DateTime<Utc>` instance into a `DateTime<Local>` instance.
|
||||
///
|
||||
@ -696,7 +691,6 @@ impl From<DateTime<FixedOffset>> for DateTime<Utc> {
|
||||
|
||||
/// Convert a `DateTime<FixedOffset>` instance into a `DateTime<Local>` instance.
|
||||
#[cfg(feature = "clock")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "clock")))]
|
||||
impl From<DateTime<FixedOffset>> for DateTime<Local> {
|
||||
/// Convert this `DateTime<FixedOffset>` instance into a `DateTime<Local>` instance.
|
||||
///
|
||||
@ -709,7 +703,6 @@ impl From<DateTime<FixedOffset>> for DateTime<Local> {
|
||||
|
||||
/// Convert a `DateTime<Local>` instance into a `DateTime<Utc>` instance.
|
||||
#[cfg(feature = "clock")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "clock")))]
|
||||
impl From<DateTime<Local>> for DateTime<Utc> {
|
||||
/// Convert this `DateTime<Local>` instance into a `DateTime<Utc>` instance.
|
||||
///
|
||||
@ -722,7 +715,6 @@ impl From<DateTime<Local>> for DateTime<Utc> {
|
||||
|
||||
/// Convert a `DateTime<Local>` instance into a `DateTime<FixedOffset>` instance.
|
||||
#[cfg(feature = "clock")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "clock")))]
|
||||
impl From<DateTime<Local>> for DateTime<FixedOffset> {
|
||||
/// Convert this `DateTime<Local>` instance into a `DateTime<FixedOffset>` instance.
|
||||
///
|
||||
@ -868,7 +860,6 @@ where
|
||||
{
|
||||
/// Formats the combined date and time with the specified formatting items.
|
||||
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "std"))))]
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn format_with_items<'a, I, B>(&self, items: I) -> DelayedFormat<I>
|
||||
@ -893,7 +884,6 @@ where
|
||||
/// assert_eq!(formatted, "02/04/2017 12:50");
|
||||
/// ```
|
||||
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "std"))))]
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn format<'a>(&self, fmt: &'a str) -> DelayedFormat<StrftimeItems<'a>> {
|
||||
@ -902,7 +892,6 @@ where
|
||||
|
||||
/// Formats the combined date and time with the specified formatting items and locale.
|
||||
#[cfg(feature = "unstable-locales")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-locales")))]
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn format_localized_with_items<'a, I, B>(
|
||||
@ -930,7 +919,6 @@ where
|
||||
/// See the [`crate::format::strftime`] module on the supported escape
|
||||
/// sequences.
|
||||
#[cfg(feature = "unstable-locales")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-locales")))]
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn format_localized<'a>(
|
||||
@ -1401,7 +1389,6 @@ impl str::FromStr for DateTime<Utc> {
|
||||
/// # Ok::<(), chrono::ParseError>(())
|
||||
/// ```
|
||||
#[cfg(feature = "clock")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "clock")))]
|
||||
impl str::FromStr for DateTime<Local> {
|
||||
type Err = ParseError;
|
||||
|
||||
@ -1411,7 +1398,6 @@ impl str::FromStr for DateTime<Local> {
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
||||
impl From<SystemTime> for DateTime<Utc> {
|
||||
fn from(t: SystemTime) -> DateTime<Utc> {
|
||||
let (sec, nsec) = match t.duration_since(UNIX_EPOCH) {
|
||||
@ -1432,7 +1418,6 @@ impl From<SystemTime> for DateTime<Utc> {
|
||||
}
|
||||
|
||||
#[cfg(feature = "clock")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "clock")))]
|
||||
impl From<SystemTime> for DateTime<Local> {
|
||||
fn from(t: SystemTime) -> DateTime<Local> {
|
||||
DateTime::<Utc>::from(t).with_timezone(&Local)
|
||||
@ -1440,7 +1425,6 @@ impl From<SystemTime> for DateTime<Local> {
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
||||
impl<Tz: TimeZone> From<DateTime<Tz>> for SystemTime {
|
||||
fn from(dt: DateTime<Tz>) -> SystemTime {
|
||||
let sec = dt.timestamp();
|
||||
@ -1459,14 +1443,6 @@ impl<Tz: TimeZone> From<DateTime<Tz>> for SystemTime {
|
||||
feature = "wasmbind",
|
||||
not(any(target_os = "emscripten", target_os = "wasi"))
|
||||
))]
|
||||
#[cfg_attr(
|
||||
docsrs,
|
||||
doc(cfg(all(
|
||||
target_arch = "wasm32",
|
||||
feature = "wasmbind",
|
||||
not(any(target_os = "emscripten", target_os = "wasi"))
|
||||
)))
|
||||
)]
|
||||
impl From<js_sys::Date> for DateTime<Utc> {
|
||||
fn from(date: js_sys::Date) -> DateTime<Utc> {
|
||||
DateTime::<Utc>::from(&date)
|
||||
@ -1478,14 +1454,6 @@ impl From<js_sys::Date> for DateTime<Utc> {
|
||||
feature = "wasmbind",
|
||||
not(any(target_os = "emscripten", target_os = "wasi"))
|
||||
))]
|
||||
#[cfg_attr(
|
||||
docsrs,
|
||||
doc(cfg(all(
|
||||
target_arch = "wasm32",
|
||||
feature = "wasmbind",
|
||||
not(any(target_os = "emscripten", target_os = "wasi"))
|
||||
)))
|
||||
)]
|
||||
impl From<&js_sys::Date> for DateTime<Utc> {
|
||||
fn from(date: &js_sys::Date) -> DateTime<Utc> {
|
||||
Utc.timestamp_millis_opt(date.get_time() as i64).unwrap()
|
||||
@ -1497,14 +1465,6 @@ impl From<&js_sys::Date> for DateTime<Utc> {
|
||||
feature = "wasmbind",
|
||||
not(any(target_os = "emscripten", target_os = "wasi"))
|
||||
))]
|
||||
#[cfg_attr(
|
||||
docsrs,
|
||||
doc(cfg(all(
|
||||
target_arch = "wasm32",
|
||||
feature = "wasmbind",
|
||||
not(any(target_os = "emscripten", target_os = "wasi"))
|
||||
)))
|
||||
)]
|
||||
impl From<DateTime<Utc>> for js_sys::Date {
|
||||
/// Converts a `DateTime<Utc>` to a JS `Date`. The resulting value may be lossy,
|
||||
/// any values that have a millisecond timestamp value greater/less than ±8,640,000,000,000,000
|
||||
|
@ -1,5 +1,3 @@
|
||||
#![cfg_attr(docsrs, doc(cfg(feature = "rustc-serialize")))]
|
||||
|
||||
use super::{DateTime, SecondsFormat};
|
||||
#[cfg(feature = "clock")]
|
||||
use crate::offset::Local;
|
||||
@ -82,7 +80,6 @@ impl Decodable for TsSeconds<Utc> {
|
||||
}
|
||||
|
||||
#[cfg(feature = "clock")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "clock")))]
|
||||
impl Decodable for DateTime<Local> {
|
||||
fn decode<D: Decoder>(d: &mut D) -> Result<DateTime<Local>, D::Error> {
|
||||
match d.read_str()?.parse::<DateTime<FixedOffset>>() {
|
||||
@ -93,7 +90,6 @@ impl Decodable for DateTime<Local> {
|
||||
}
|
||||
|
||||
#[cfg(feature = "clock")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "clock")))]
|
||||
#[allow(deprecated)]
|
||||
impl Decodable for TsSeconds<Local> {
|
||||
#[allow(deprecated)]
|
||||
|
@ -1,5 +1,3 @@
|
||||
#![cfg_attr(docsrs, doc(cfg(feature = "serde")))]
|
||||
|
||||
use core::fmt;
|
||||
use serde::{de, ser};
|
||||
|
||||
@ -107,7 +105,6 @@ impl<'de> de::Deserialize<'de> for DateTime<Utc> {
|
||||
/// See [the `serde` module](./serde/index.html) for alternate
|
||||
/// serialization formats.
|
||||
#[cfg(feature = "clock")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "clock")))]
|
||||
impl<'de> de::Deserialize<'de> for DateTime<Local> {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
|
@ -46,7 +46,6 @@ use locales::*;
|
||||
/// A *temporary* object which can be used as an argument to `format!` or others.
|
||||
/// This is normally constructed via `format` methods of each date and time type.
|
||||
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "std"))))]
|
||||
#[derive(Debug)]
|
||||
pub struct DelayedFormat<I> {
|
||||
/// The date view, if any.
|
||||
@ -103,7 +102,6 @@ impl<'a, I: Iterator<Item = B> + Clone, B: Borrow<Item<'a>>> DelayedFormat<I> {
|
||||
|
||||
/// Makes a new `DelayedFormat` value out of local date and time and locale.
|
||||
#[cfg(feature = "unstable-locales")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-locales")))]
|
||||
#[must_use]
|
||||
pub fn new_with_locale(
|
||||
date: Option<NaiveDate>,
|
||||
@ -116,7 +114,6 @@ impl<'a, I: Iterator<Item = B> + Clone, B: Borrow<Item<'a>>> DelayedFormat<I> {
|
||||
|
||||
/// Makes a new `DelayedFormat` value out of local date and time, UTC offset and locale.
|
||||
#[cfg(feature = "unstable-locales")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-locales")))]
|
||||
#[must_use]
|
||||
pub fn new_with_offset_and_locale<Off>(
|
||||
date: Option<NaiveDate>,
|
||||
@ -157,7 +154,6 @@ impl<'a, I: Iterator<Item = B> + Clone, B: Borrow<Item<'a>>> fmt::Display for De
|
||||
/// Tries to format given arguments with given formatting items.
|
||||
/// Internally used by `DelayedFormat`.
|
||||
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "std"))))]
|
||||
pub fn format<'a, I, B>(
|
||||
w: &mut fmt::Formatter,
|
||||
date: Option<&NaiveDate>,
|
||||
@ -177,7 +173,6 @@ where
|
||||
}
|
||||
/// Formats single formatting item
|
||||
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "std"))))]
|
||||
pub fn format_item(
|
||||
w: &mut fmt::Formatter,
|
||||
date: Option<&NaiveDate>,
|
||||
@ -193,7 +188,6 @@ pub fn format_item(
|
||||
/// Tries to format given arguments with given formatting items.
|
||||
/// Internally used by `DelayedFormat`.
|
||||
#[cfg(feature = "unstable-locales")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-locales")))]
|
||||
pub fn format_localized<'a, I, B>(
|
||||
w: &mut fmt::Formatter,
|
||||
date: Option<&NaiveDate>,
|
||||
@ -215,7 +209,6 @@ where
|
||||
|
||||
/// Formats single formatting item
|
||||
#[cfg(feature = "unstable-locales")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-locales")))]
|
||||
pub fn format_item_localized(
|
||||
w: &mut fmt::Formatter,
|
||||
date: Option<&NaiveDate>,
|
||||
|
@ -333,13 +333,11 @@ pub enum Item<'a> {
|
||||
Literal(&'a str),
|
||||
/// Same as `Literal` but with the string owned by the item.
|
||||
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "std"))))]
|
||||
OwnedLiteral(Box<str>),
|
||||
/// Whitespace. Prints literally but reads zero or more whitespace.
|
||||
Space(&'a str),
|
||||
/// Same as `Space` but with the string owned by the item.
|
||||
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "std"))))]
|
||||
OwnedSpace(Box<str>),
|
||||
/// Numeric item. Can be optionally padded to the maximal length (if any) when formatting;
|
||||
/// the parser simply ignores any padded whitespace and zeroes.
|
||||
@ -437,7 +435,6 @@ impl fmt::Display for ParseError {
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
||||
impl Error for ParseError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
|
@ -191,7 +191,6 @@ impl<'a> StrftimeItems<'a> {
|
||||
|
||||
/// Creates a new parsing iterator from the `strftime`-like format string.
|
||||
#[cfg(feature = "unstable-locales")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-locales")))]
|
||||
#[must_use]
|
||||
pub const fn new_with_locale(s: &'a str, locale: Locale) -> StrftimeItems<'a> {
|
||||
StrftimeItems { remainder: s, queue: &[], locale_str: "", locale: Some(locale) }
|
||||
|
@ -469,7 +469,7 @@
|
||||
// can remove this if/when rustc-serialize support is removed
|
||||
// keeps clippy happy in the meantime
|
||||
#![cfg_attr(feature = "rustc-serialize", allow(deprecated))]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
||||
|
||||
#[cfg(feature = "alloc")]
|
||||
extern crate alloc;
|
||||
@ -487,11 +487,9 @@ pub mod prelude {
|
||||
#[allow(deprecated)]
|
||||
pub use crate::Date;
|
||||
#[cfg(feature = "clock")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "clock")))]
|
||||
#[doc(no_inline)]
|
||||
pub use crate::Local;
|
||||
#[cfg(feature = "unstable-locales")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-locales")))]
|
||||
#[doc(no_inline)]
|
||||
pub use crate::Locale;
|
||||
#[doc(no_inline)]
|
||||
@ -514,7 +512,6 @@ pub use date::{Date, MAX_DATE, MIN_DATE};
|
||||
|
||||
mod datetime;
|
||||
#[cfg(feature = "rustc-serialize")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "rustc-serialize")))]
|
||||
pub use datetime::rustc_serialize::TsSeconds;
|
||||
#[allow(deprecated)]
|
||||
pub use datetime::{DateTime, SecondsFormat, MAX_DATETIME, MIN_DATETIME};
|
||||
@ -522,7 +519,6 @@ pub use datetime::{DateTime, SecondsFormat, MAX_DATETIME, MIN_DATETIME};
|
||||
pub mod format;
|
||||
/// L10n locales.
|
||||
#[cfg(feature = "unstable-locales")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-locales")))]
|
||||
pub use format::Locale;
|
||||
pub use format::{ParseError, ParseResult};
|
||||
|
||||
@ -532,7 +528,6 @@ pub use naive::{Days, IsoWeek, NaiveDate, NaiveDateTime, NaiveTime, NaiveWeek};
|
||||
|
||||
pub mod offset;
|
||||
#[cfg(feature = "clock")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "clock")))]
|
||||
#[doc(no_inline)]
|
||||
pub use offset::Local;
|
||||
#[doc(no_inline)]
|
||||
@ -564,7 +559,6 @@ pub use naive::__BenchYearFlags;
|
||||
/// [1]: https://tools.ietf.org/html/rfc3339
|
||||
/// [2]: https://serde.rs/field-attrs.html#with
|
||||
#[cfg(feature = "serde")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "serde")))]
|
||||
pub mod serde {
|
||||
pub use super::datetime::serde::*;
|
||||
}
|
||||
@ -573,7 +567,6 @@ pub mod serde {
|
||||
///
|
||||
/// This module re-exports the `Archived*` versions of chrono's types.
|
||||
#[cfg(feature = "rkyv")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "rkyv")))]
|
||||
pub mod rkyv {
|
||||
pub use crate::datetime::ArchivedDateTime;
|
||||
pub use crate::duration::ArchivedDuration;
|
||||
|
@ -236,7 +236,6 @@ pub struct ParseMonthError {
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
||||
impl std::error::Error for ParseMonthError {}
|
||||
|
||||
impl fmt::Display for ParseMonthError {
|
||||
@ -252,7 +251,6 @@ impl fmt::Debug for ParseMonthError {
|
||||
}
|
||||
|
||||
#[cfg(feature = "serde")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "serde")))]
|
||||
mod month_serde {
|
||||
use super::Month;
|
||||
use serde::{de, ser};
|
||||
|
@ -1265,7 +1265,6 @@ impl NaiveDate {
|
||||
/// assert_eq!(format!("{}", d.format_with_items(fmt)), "2015-09-05");
|
||||
/// ```
|
||||
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "std"))))]
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn format_with_items<'a, I, B>(&self, items: I) -> DelayedFormat<I>
|
||||
@ -1309,7 +1308,6 @@ impl NaiveDate {
|
||||
/// assert_eq!(format!("{}", d.format("%A, %-d %B, %C%y")), "Saturday, 5 September, 2015");
|
||||
/// ```
|
||||
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "std"))))]
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn format<'a>(&self, fmt: &'a str) -> DelayedFormat<StrftimeItems<'a>> {
|
||||
@ -1318,7 +1316,6 @@ impl NaiveDate {
|
||||
|
||||
/// Formats the date with the specified formatting items and locale.
|
||||
#[cfg(feature = "unstable-locales")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-locales")))]
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn format_localized_with_items<'a, I, B>(
|
||||
@ -1338,7 +1335,6 @@ impl NaiveDate {
|
||||
/// See the [`crate::format::strftime`] module on the supported escape
|
||||
/// sequences.
|
||||
#[cfg(feature = "unstable-locales")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-locales")))]
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn format_localized<'a>(
|
||||
@ -2276,7 +2272,6 @@ where
|
||||
}
|
||||
|
||||
#[cfg(feature = "rustc-serialize")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "rustc-serialize")))]
|
||||
mod rustc_serialize {
|
||||
use super::NaiveDate;
|
||||
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
|
||||
@ -2311,7 +2306,6 @@ mod rustc_serialize {
|
||||
}
|
||||
|
||||
#[cfg(feature = "serde")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "serde")))]
|
||||
mod serde {
|
||||
use super::NaiveDate;
|
||||
use core::fmt;
|
||||
|
@ -894,7 +894,6 @@ impl NaiveDateTime {
|
||||
/// assert_eq!(format!("{}", dt.format_with_items(fmt)), "2015-09-05 23:56:04");
|
||||
/// ```
|
||||
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "std"))))]
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn format_with_items<'a, I, B>(&self, items: I) -> DelayedFormat<I>
|
||||
@ -938,7 +937,6 @@ impl NaiveDateTime {
|
||||
/// assert_eq!(format!("{}", dt.format("around %l %p on %b %-d")), "around 11 PM on Sep 5");
|
||||
/// ```
|
||||
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "std"))))]
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn format<'a>(&self, fmt: &'a str) -> DelayedFormat<StrftimeItems<'a>> {
|
||||
|
@ -1,5 +1,3 @@
|
||||
#![cfg_attr(docsrs, doc(cfg(feature = "rustc-serialize")))]
|
||||
|
||||
use super::NaiveDateTime;
|
||||
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
|
||||
use std::ops::Deref;
|
||||
|
@ -1,5 +1,3 @@
|
||||
#![cfg_attr(docsrs, doc(cfg(feature = "serde")))]
|
||||
|
||||
use core::fmt;
|
||||
use serde::{de, ser};
|
||||
|
||||
|
@ -34,7 +34,6 @@ pub use self::internals::YearFlags as __BenchYearFlags;
|
||||
/// [1]: https://serde.rs/attributes.html#field-attributes
|
||||
/// [2]: https://tools.ietf.org/html/rfc3339
|
||||
#[cfg(feature = "serde")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "serde")))]
|
||||
pub mod serde {
|
||||
pub use super::datetime::serde::*;
|
||||
}
|
||||
|
@ -778,7 +778,6 @@ impl NaiveTime {
|
||||
/// assert_eq!(format!("{}", t.format_with_items(fmt)), "23:56:04");
|
||||
/// ```
|
||||
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "std"))))]
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn format_with_items<'a, I, B>(&self, items: I) -> DelayedFormat<I>
|
||||
@ -824,7 +823,6 @@ impl NaiveTime {
|
||||
/// assert_eq!(format!("{}", t.format("%-I:%M %p")), "11:56 PM");
|
||||
/// ```
|
||||
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "std"))))]
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn format<'a>(&self, fmt: &'a str) -> DelayedFormat<StrftimeItems<'a>> {
|
||||
|
@ -1,5 +1,3 @@
|
||||
#![cfg_attr(docsrs, doc(cfg(feature = "rustc-serialize")))]
|
||||
|
||||
use super::NaiveTime;
|
||||
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
#![cfg_attr(docsrs, doc(cfg(feature = "serde")))]
|
||||
|
||||
use super::NaiveTime;
|
||||
use core::fmt;
|
||||
use serde::{de, ser};
|
||||
|
@ -46,7 +46,6 @@ use crate::{Date, DateTime};
|
||||
pub struct Utc;
|
||||
|
||||
#[cfg(feature = "clock")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "clock")))]
|
||||
impl Utc {
|
||||
/// Returns a `Date` which corresponds to the current date.
|
||||
#[deprecated(
|
||||
|
@ -291,7 +291,6 @@ impl fmt::Display for RoundingError {
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
||||
impl std::error::Error for RoundingError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
|
@ -227,7 +227,6 @@ pub struct ParseWeekdayError {
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
||||
impl std::error::Error for ParseWeekdayError {}
|
||||
|
||||
impl fmt::Display for ParseWeekdayError {
|
||||
@ -245,7 +244,6 @@ impl fmt::Debug for ParseWeekdayError {
|
||||
// the actual `FromStr` implementation is in the `format` module to leverage the existing code
|
||||
|
||||
#[cfg(feature = "serde")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "serde")))]
|
||||
mod weekday_serde {
|
||||
use super::Weekday;
|
||||
use core::fmt;
|
||||
|
Loading…
x
Reference in New Issue
Block a user