diff --git a/docs/chrono/all.html b/docs/chrono/all.html deleted file mode 100644 index 32b10cbb..00000000 --- a/docs/chrono/all.html +++ /dev/null @@ -1,6 +0,0 @@ -List of all items in this crate - -

[] - - List of all items

Structs

Enums

Traits

Functions

Typedefs

Constants

\ No newline at end of file diff --git a/docs/chrono/constant.MAX_DATE.html b/docs/chrono/constant.MAX_DATE.html deleted file mode 100644 index e0c110e3..00000000 --- a/docs/chrono/constant.MAX_DATE.html +++ /dev/null @@ -1,5 +0,0 @@ -chrono::MAX_DATE - Rust - -

[][src]Constant chrono::MAX_DATE

pub const MAX_DATE: Date<Utc>;

The maximum possible Date.

-
\ No newline at end of file diff --git a/docs/chrono/constant.MAX_DATETIME.html b/docs/chrono/constant.MAX_DATETIME.html deleted file mode 100644 index a4073f4b..00000000 --- a/docs/chrono/constant.MAX_DATETIME.html +++ /dev/null @@ -1,5 +0,0 @@ -chrono::MAX_DATETIME - Rust - -

[][src]Constant chrono::MAX_DATETIME

pub const MAX_DATETIME: DateTime<Utc>;

The maximum possible DateTime<Utc>.

-
\ No newline at end of file diff --git a/docs/chrono/constant.MIN_DATE.html b/docs/chrono/constant.MIN_DATE.html deleted file mode 100644 index 54a2c97c..00000000 --- a/docs/chrono/constant.MIN_DATE.html +++ /dev/null @@ -1,5 +0,0 @@ -chrono::MIN_DATE - Rust - -

[][src]Constant chrono::MIN_DATE

pub const MIN_DATE: Date<Utc>;

The minimum possible Date.

-
\ No newline at end of file diff --git a/docs/chrono/constant.MIN_DATETIME.html b/docs/chrono/constant.MIN_DATETIME.html deleted file mode 100644 index c689c95d..00000000 --- a/docs/chrono/constant.MIN_DATETIME.html +++ /dev/null @@ -1,5 +0,0 @@ -chrono::MIN_DATETIME - Rust - -

[][src]Constant chrono::MIN_DATETIME

pub const MIN_DATETIME: DateTime<Utc>;

The minimum possible DateTime<Utc>.

-
\ No newline at end of file diff --git a/docs/chrono/date/constant.MAX_DATE.html b/docs/chrono/date/constant.MAX_DATE.html deleted file mode 100644 index 505d689a..00000000 --- a/docs/chrono/date/constant.MAX_DATE.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -

Redirecting to ../../chrono/constant.MAX_DATE.html...

- - - \ No newline at end of file diff --git a/docs/chrono/date/constant.MIN_DATE.html b/docs/chrono/date/constant.MIN_DATE.html deleted file mode 100644 index 7be73ede..00000000 --- a/docs/chrono/date/constant.MIN_DATE.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -

Redirecting to ../../chrono/constant.MIN_DATE.html...

- - - \ No newline at end of file diff --git a/docs/chrono/date/struct.Date.html b/docs/chrono/date/struct.Date.html deleted file mode 100644 index 1239b601..00000000 --- a/docs/chrono/date/struct.Date.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -

Redirecting to ../../chrono/struct.Date.html...

- - - \ No newline at end of file diff --git a/docs/chrono/datetime/constant.MAX_DATETIME.html b/docs/chrono/datetime/constant.MAX_DATETIME.html deleted file mode 100644 index fc29ea84..00000000 --- a/docs/chrono/datetime/constant.MAX_DATETIME.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -

Redirecting to ../../chrono/constant.MAX_DATETIME.html...

- - - \ No newline at end of file diff --git a/docs/chrono/datetime/constant.MIN_DATETIME.html b/docs/chrono/datetime/constant.MIN_DATETIME.html deleted file mode 100644 index e7ce3f6c..00000000 --- a/docs/chrono/datetime/constant.MIN_DATETIME.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -

Redirecting to ../../chrono/constant.MIN_DATETIME.html...

- - - \ No newline at end of file diff --git a/docs/chrono/datetime/enum.SecondsFormat.html b/docs/chrono/datetime/enum.SecondsFormat.html deleted file mode 100644 index 26123ce9..00000000 --- a/docs/chrono/datetime/enum.SecondsFormat.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -

Redirecting to ../../chrono/enum.SecondsFormat.html...

- - - \ No newline at end of file diff --git a/docs/chrono/datetime/struct.DateTime.html b/docs/chrono/datetime/struct.DateTime.html deleted file mode 100644 index 7af8741a..00000000 --- a/docs/chrono/datetime/struct.DateTime.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -

Redirecting to ../../chrono/struct.DateTime.html...

- - - \ No newline at end of file diff --git a/docs/chrono/enum.Month.html b/docs/chrono/enum.Month.html deleted file mode 100644 index b839f78d..00000000 --- a/docs/chrono/enum.Month.html +++ /dev/null @@ -1,138 +0,0 @@ -chrono::Month - Rust - -

[][src]Enum chrono::Month

pub enum Month {
-    January,
-    February,
-    March,
-    April,
-    May,
-    June,
-    July,
-    August,
-    September,
-    October,
-    November,
-    December,
-}

The month of the year.

-

This enum is just a convenience implementation. -The month in dates created by DateLike objects does not return this enum.

-

It is possible to convert from a date to a month independently

- -
-use num_traits::FromPrimitive;
-use chrono::prelude::*;
-let date = Utc.ymd(2019, 10, 28).and_hms(9, 10, 11);
-// `2019-10-28T09:10:11Z`
-let month = Month::from_u32(date.month());
-assert_eq!(month, Some(Month::October))
-

Or from a Month to an integer usable by dates

- -
-let month = Month::January;
-let dt = Utc.ymd(2019, month.number_from_month(), 28).and_hms(9, 10, 11);
-assert_eq!((dt.year(), dt.month(), dt.day()), (2019, 1, 28));
-

Allows mapping from and to month, from 1-January to 12-December. -Can be Serialized/Deserialized with serde

-

- Variants

-
January

January

-
February

February

-
March

March

-
April

April

-
May

May

-
June

June

-
July

July

-
August

August

-
September

September

-
October

October

-
November

November

-
December

December

-

Implementations

impl Month[src]

pub fn succ(&self) -> Month[src]

The next month.

- - -
m:JanuaryFebruary...December
m.succ():FebruaryMarch...January
-

pub fn pred(&self) -> Month[src]

The previous month.

- - -
m:JanuaryFebruary...December
m.succ():DecemberJanuary...November
-

pub fn number_from_month(&self) -> u32[src]

Returns a month-of-year number starting from January = 1.

- - -
m:JanuaryFebruary...December
m.number_from_month():12...12
-

pub fn name(&self) -> &'static str[src]

Get the name of the month

- -
-use chrono::Month;
-
-assert_eq!(Month::January.name(), "January")
-

Trait Implementations

impl Clone for Month[src]

impl Copy for Month[src]

impl Debug for Month[src]

impl Eq for Month[src]

impl FromPrimitive for Month[src]

fn from_u64(n: u64) -> Option<Month>[src]

Returns an Option from a i64, assuming a 1-index, January = 1.

-

Month::from_i64(n: i64): | 1 | 2 | ... | 12 ----------------------------| -------------------- | --------------------- | ... | ----- -``: | Some(Month::January) | Some(Month::February) | ... | Some(Month::December)

-

impl FromStr for Month[src]

Parsing a str into a Month uses the format %W.

-

Example

-
-use chrono::Month;
-
-assert_eq!("January".parse::<Month>(), Ok(Month::January));
-assert!("any day".parse::<Month>().is_err());
-

The parsing is case-insensitive.

- -
-assert_eq!("fEbruARy".parse::<Month>(), Ok(Month::February));
-

Only the shortest form (e.g. jan) and the longest form (e.g. january) is accepted.

- -
-assert!("septem".parse::<Month>().is_err());
-assert!("Augustin".parse::<Month>().is_err());
-

type Err = ParseMonthError

The associated error which can be returned from parsing.

-

impl Hash for Month[src]

impl PartialEq<Month> for Month[src]

impl StructuralEq for Month[src]

impl StructuralPartialEq for Month[src]

Auto Trait Implementations

impl RefUnwindSafe for Month[src]

impl Send for Month[src]

impl Sync for Month[src]

impl Unpin for Month[src]

impl UnwindSafe for Month[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

-

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-
\ No newline at end of file diff --git a/docs/chrono/enum.RoundingError.html b/docs/chrono/enum.RoundingError.html deleted file mode 100644 index 5132cbad..00000000 --- a/docs/chrono/enum.RoundingError.html +++ /dev/null @@ -1,61 +0,0 @@ -chrono::RoundingError - Rust - -

[][src]Enum chrono::RoundingError

pub enum RoundingError {
-    DurationExceedsTimestamp,
-    DurationExceedsLimit,
-    TimestampExceedsLimit,
-}

An error from rounding by Duration

-

See: DurationRound

-

- Variants

-
DurationExceedsTimestamp

Error when the Duration exceeds the Duration from or until the Unix epoch.

- -
-let dt = Utc.ymd(1970, 12, 12).and_hms(0, 0, 0);
-
-assert_eq!(
-    dt.duration_round(Duration::days(365)),
-    Err(RoundingError::DurationExceedsTimestamp),
-);
-
DurationExceedsLimit

Error when Duration.num_nanoseconds exceeds the limit.

- -
-let dt = Utc.ymd(2260, 12, 31).and_hms_nano(23, 59, 59, 1_75_500_000);
-
-assert_eq!(
-    dt.duration_round(Duration::days(300 * 365)),
-    Err(RoundingError::DurationExceedsLimit)
-);
-
TimestampExceedsLimit

Error when DateTime.timestamp_nanos exceeds the limit.

- -
-let dt = Utc.ymd(2300, 12, 12).and_hms(0, 0, 0);
-
-assert_eq!(dt.duration_round(Duration::days(1)), Err(RoundingError::TimestampExceedsLimit),);
-

Trait Implementations

impl Clone for RoundingError[src]

impl Copy for RoundingError[src]

impl Debug for RoundingError[src]

impl Display for RoundingError[src]

impl Eq for RoundingError[src]

impl Error for RoundingError[src]

impl PartialEq<RoundingError> for RoundingError[src]

impl StructuralEq for RoundingError[src]

impl StructuralPartialEq for RoundingError[src]

Auto Trait Implementations

impl RefUnwindSafe for RoundingError[src]

impl Send for RoundingError[src]

impl Sync for RoundingError[src]

impl Unpin for RoundingError[src]

impl UnwindSafe for RoundingError[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

-

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-
\ No newline at end of file diff --git a/docs/chrono/enum.SecondsFormat.html b/docs/chrono/enum.SecondsFormat.html deleted file mode 100644 index 79f61110..00000000 --- a/docs/chrono/enum.SecondsFormat.html +++ /dev/null @@ -1,45 +0,0 @@ -chrono::SecondsFormat - Rust - -

[][src]Enum chrono::SecondsFormat

pub enum SecondsFormat {
-    Secs,
-    Millis,
-    Micros,
-    Nanos,
-    AutoSi,
-    // some variants omitted
-}

Specific formatting options for seconds. This may be extended in the -future, so exhaustive matching in external code is not recommended.

-

See the TimeZone::to_rfc3339_opts function for usage.

-

- Variants

-
Secs

Format whole seconds only, with no decimal point nor subseconds.

-
Millis

Use fixed 3 subsecond digits. This corresponds to -Fixed::Nanosecond3.

-
Micros

Use fixed 6 subsecond digits. This corresponds to -Fixed::Nanosecond6.

-
Nanos

Use fixed 9 subsecond digits. This corresponds to -Fixed::Nanosecond9.

-
AutoSi

Automatically select one of Secs, Millis, Micros, or Nanos to -display all available non-zero sub-second digits. This corresponds to -Fixed::Nanosecond.

-

Trait Implementations

impl Clone for SecondsFormat[src]

impl Copy for SecondsFormat[src]

impl Debug for SecondsFormat[src]

impl Eq for SecondsFormat[src]

impl PartialEq<SecondsFormat> for SecondsFormat[src]

impl StructuralEq for SecondsFormat[src]

impl StructuralPartialEq for SecondsFormat[src]

Auto Trait Implementations

impl RefUnwindSafe for SecondsFormat[src]

impl Send for SecondsFormat[src]

impl Sync for SecondsFormat[src]

impl Unpin for SecondsFormat[src]

impl UnwindSafe for SecondsFormat[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

-

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-
\ No newline at end of file diff --git a/docs/chrono/enum.Weekday.html b/docs/chrono/enum.Weekday.html deleted file mode 100644 index e3105b92..00000000 --- a/docs/chrono/enum.Weekday.html +++ /dev/null @@ -1,120 +0,0 @@ -chrono::Weekday - Rust - -

[][src]Enum chrono::Weekday

pub enum Weekday {
-    Mon,
-    Tue,
-    Wed,
-    Thu,
-    Fri,
-    Sat,
-    Sun,
-}

The day of week.

-

The order of the days of week depends on the context. -(This is why this type does not implement PartialOrd or Ord traits.) -One should prefer *_from_monday or *_from_sunday methods to get the correct result.

-

- Variants

-
Mon

Monday.

-
Tue

Tuesday.

-
Wed

Wednesday.

-
Thu

Thursday.

-
Fri

Friday.

-
Sat

Saturday.

-
Sun

Sunday.

-

Implementations

impl Weekday[src]

pub fn succ(&self) -> Weekday[src]

The next day in the week.

- - -
w:MonTueWedThuFriSatSun
w.succ():TueWedThuFriSatSunMon
-

pub fn pred(&self) -> Weekday[src]

The previous day in the week.

- - -
w:MonTueWedThuFriSatSun
w.pred():SunMonTueWedThuFriSat
-

pub fn number_from_monday(&self) -> u32[src]

Returns a day-of-week number starting from Monday = 1. (ISO 8601 weekday number)

- - -
w:MonTueWedThuFriSatSun
w.number_from_monday():1234567
-

pub fn number_from_sunday(&self) -> u32[src]

Returns a day-of-week number starting from Sunday = 1.

- - -
w:MonTueWedThuFriSatSun
w.number_from_sunday():2345671
-

pub fn num_days_from_monday(&self) -> u32[src]

Returns a day-of-week number starting from Monday = 0.

- - -
w:MonTueWedThuFriSatSun
w.num_days_from_monday():0123456
-

pub fn num_days_from_sunday(&self) -> u32[src]

Returns a day-of-week number starting from Sunday = 0.

- - -
w:MonTueWedThuFriSatSun
w.num_days_from_sunday():1234560
-

Trait Implementations

impl Clone for Weekday[src]

impl Copy for Weekday[src]

impl Debug for Weekday[src]

impl Display for Weekday[src]

impl Eq for Weekday[src]

impl FromPrimitive for Weekday[src]

Any weekday can be represented as an integer from 0 to 6, which equals to -Weekday::num_days_from_monday in this implementation. -Do not heavily depend on this though; use explicit methods whenever possible.

-

impl FromStr for Weekday[src]

Parsing a str into a Weekday uses the format %W.

-

Example

-
-use chrono::Weekday;
-
-assert_eq!("Sunday".parse::<Weekday>(), Ok(Weekday::Sun));
-assert!("any day".parse::<Weekday>().is_err());
-

The parsing is case-insensitive.

- -
-assert_eq!("mON".parse::<Weekday>(), Ok(Weekday::Mon));
-

Only the shortest form (e.g. sun) and the longest form (e.g. sunday) is accepted.

- -
-assert!("thurs".parse::<Weekday>().is_err());
-

type Err = ParseWeekdayError

The associated error which can be returned from parsing.

-

impl Hash for Weekday[src]

impl PartialEq<Weekday> for Weekday[src]

impl StructuralEq for Weekday[src]

impl StructuralPartialEq for Weekday[src]

Auto Trait Implementations

impl RefUnwindSafe for Weekday[src]

impl Send for Weekday[src]

impl Sync for Weekday[src]

impl Unpin for Weekday[src]

impl UnwindSafe for Weekday[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

-

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-
\ No newline at end of file diff --git a/docs/chrono/format/enum.Fixed.html b/docs/chrono/format/enum.Fixed.html deleted file mode 100644 index 3548ed14..00000000 --- a/docs/chrono/format/enum.Fixed.html +++ /dev/null @@ -1,85 +0,0 @@ -chrono::format::Fixed - Rust - -

[][src]Enum chrono::format::Fixed

pub enum Fixed {
-    ShortMonthName,
-    LongMonthName,
-    ShortWeekdayName,
-    LongWeekdayName,
-    LowerAmPm,
-    UpperAmPm,
-    Nanosecond,
-    Nanosecond3,
-    Nanosecond6,
-    Nanosecond9,
-    TimezoneName,
-    TimezoneOffsetColon,
-    TimezoneOffsetColonZ,
-    TimezoneOffset,
-    TimezoneOffsetZ,
-    RFC2822,
-    RFC3339,
-    Internal(InternalFixed),
-}

Fixed-format item types.

-

They have their own rules of formatting and parsing. -Otherwise noted, they print in the specified cases but parse case-insensitively.

-

- Variants

-
ShortMonthName

Abbreviated month names.

-

Prints a three-letter-long name in the title case, reads the same name in any case.

-
LongMonthName

Full month names.

-

Prints a full name in the title case, reads either a short or full name in any case.

-
ShortWeekdayName

Abbreviated day of the week names.

-

Prints a three-letter-long name in the title case, reads the same name in any case.

-
LongWeekdayName

Full day of the week names.

-

Prints a full name in the title case, reads either a short or full name in any case.

-
LowerAmPm

AM/PM.

-

Prints in lower case, reads in any case.

-
UpperAmPm

AM/PM.

-

Prints in upper case, reads in any case.

-
Nanosecond

An optional dot plus one or more digits for left-aligned nanoseconds. -May print nothing, 3, 6 or 9 digits according to the available accuracy. -See also Numeric::Nanosecond.

-
Nanosecond3

Same as Nanosecond but the accuracy is fixed to 3.

-
Nanosecond6

Same as Nanosecond but the accuracy is fixed to 6.

-
Nanosecond9

Same as Nanosecond but the accuracy is fixed to 9.

-
TimezoneName

Timezone name.

-

It does not support parsing, its use in the parser is an immediate failure.

-
TimezoneOffsetColon

Offset from the local time to UTC (+09:00 or -04:00 or +00:00).

-

In the parser, the colon can be omitted and/or surrounded with any amount of whitespace. -The offset is limited from -24:00 to +24:00, -which is the same as FixedOffset's range.

-
TimezoneOffsetColonZ

Offset from the local time to UTC (+09:00 or -04:00 or Z).

-

In the parser, the colon can be omitted and/or surrounded with any amount of whitespace, -and Z can be either in upper case or in lower case. -The offset is limited from -24:00 to +24:00, -which is the same as FixedOffset's range.

-
TimezoneOffset

Same as TimezoneOffsetColon but prints no colon. -Parsing allows an optional colon.

-
TimezoneOffsetZ

Same as TimezoneOffsetColonZ but prints no colon. -Parsing allows an optional colon.

-
RFC2822

RFC 2822 date and time syntax. Commonly used for email and MIME date and time.

-
RFC3339

RFC 3339 & ISO 8601 date and time syntax.

-
Internal(InternalFixed)

Internal uses only.

-

This item exists so that one can add additional internal-only formatting -without breaking major compatibility (as enum variants cannot be selectively private).

-

Trait Implementations

impl Clone for Fixed[src]

impl Debug for Fixed[src]

impl Eq for Fixed[src]

impl PartialEq<Fixed> for Fixed[src]

impl StructuralEq for Fixed[src]

impl StructuralPartialEq for Fixed[src]

Auto Trait Implementations

impl RefUnwindSafe for Fixed[src]

impl Send for Fixed[src]

impl Sync for Fixed[src]

impl Unpin for Fixed[src]

impl UnwindSafe for Fixed[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

-

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-
\ No newline at end of file diff --git a/docs/chrono/format/enum.Item.html b/docs/chrono/format/enum.Item.html deleted file mode 100644 index b40544fb..00000000 --- a/docs/chrono/format/enum.Item.html +++ /dev/null @@ -1,42 +0,0 @@ -chrono::format::Item - Rust - -

[][src]Enum chrono::format::Item

pub enum Item<'a> {
-    Literal(&'a str),
-    OwnedLiteral(Box<str>),
-    Space(&'a str),
-    OwnedSpace(Box<str>),
-    Numeric(NumericPad),
-    Fixed(Fixed),
-    Error,
-}

A single formatting item. This is used for both formatting and parsing.

-

- Variants

-
Literal(&'a str)

A literally printed and parsed text.

-
OwnedLiteral(Box<str>)

Same as Literal but with the string owned by the item.

-
Space(&'a str)

Whitespace. Prints literally but reads zero or more whitespace.

-
OwnedSpace(Box<str>)

Same as Space but with the string owned by the item.

-
Numeric(NumericPad)

Numeric item. Can be optionally padded to the maximal length (if any) when formatting; -the parser simply ignores any padded whitespace and zeroes.

-
Fixed(Fixed)

Fixed-format item.

-
Error

Issues a formatting error. Used to signal an invalid format string.

-

Trait Implementations

impl<'a> Clone for Item<'a>[src]

impl<'a> Debug for Item<'a>[src]

impl<'a> Eq for Item<'a>[src]

impl<'a> PartialEq<Item<'a>> for Item<'a>[src]

impl<'a> StructuralEq for Item<'a>[src]

impl<'a> StructuralPartialEq for Item<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Item<'a>[src]

impl<'a> Send for Item<'a>[src]

impl<'a> Sync for Item<'a>[src]

impl<'a> Unpin for Item<'a>[src]

impl<'a> UnwindSafe for Item<'a>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

-

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-
\ No newline at end of file diff --git a/docs/chrono/format/enum.Numeric.html b/docs/chrono/format/enum.Numeric.html deleted file mode 100644 index 987e1c7e..00000000 --- a/docs/chrono/format/enum.Numeric.html +++ /dev/null @@ -1,86 +0,0 @@ -chrono::format::Numeric - Rust - -

[][src]Enum chrono::format::Numeric

pub enum Numeric {
-    Year,
-    YearDiv100,
-    YearMod100,
-    IsoYear,
-    IsoYearDiv100,
-    IsoYearMod100,
-    Month,
-    Day,
-    WeekFromSun,
-    WeekFromMon,
-    IsoWeek,
-    NumDaysFromSun,
-    WeekdayFromMon,
-    Ordinal,
-    Hour,
-    Hour12,
-    Minute,
-    Second,
-    Nanosecond,
-    Timestamp,
-    Internal(InternalNumeric),
-}

Numeric item types. -They have associated formatting width (FW) and parsing width (PW).

-

The formatting width is the minimal width to be formatted. -If the number is too short, and the padding is not Pad::None, -then it is left-padded. -If the number is too long or (in some cases) negative, it is printed as is.

-

The parsing width is the maximal width to be scanned. -The parser only tries to consume from one to given number of digits (greedily). -It also trims the preceding whitespace if any. -It cannot parse the negative number, so some date and time cannot be formatted then -parsed with the same formatting items.

-

- Variants

-
Year

Full Gregorian year (FW=4, PW=∞). -May accept years before 1 BCE or after 9999 CE, given an initial sign.

-
YearDiv100

Gregorian year divided by 100 (century number; FW=PW=2). Implies the non-negative year.

-
YearMod100

Gregorian year modulo 100 (FW=PW=2). Cannot be negative.

-
IsoYear

Year in the ISO week date (FW=4, PW=∞). -May accept years before 1 BCE or after 9999 CE, given an initial sign.

-
IsoYearDiv100

Year in the ISO week date, divided by 100 (FW=PW=2). Implies the non-negative year.

-
IsoYearMod100

Year in the ISO week date, modulo 100 (FW=PW=2). Cannot be negative.

-
Month

Month (FW=PW=2).

-
Day

Day of the month (FW=PW=2).

-
WeekFromSun

Week number, where the week 1 starts at the first Sunday of January (FW=PW=2).

-
WeekFromMon

Week number, where the week 1 starts at the first Monday of January (FW=PW=2).

-
IsoWeek

Week number in the ISO week date (FW=PW=2).

-
NumDaysFromSun

Day of the week, where Sunday = 0 and Saturday = 6 (FW=PW=1).

-
WeekdayFromMon

Day of the week, where Monday = 1 and Sunday = 7 (FW=PW=1).

-
Ordinal

Day of the year (FW=PW=3).

-
Hour

Hour number in the 24-hour clocks (FW=PW=2).

-
Hour12

Hour number in the 12-hour clocks (FW=PW=2).

-
Minute

The number of minutes since the last whole hour (FW=PW=2).

-
Second

The number of seconds since the last whole minute (FW=PW=2).

-
Nanosecond

The number of nanoseconds since the last whole second (FW=PW=9). -Note that this is not left-aligned; -see also Fixed::Nanosecond.

-
Timestamp

The number of non-leap seconds since the midnight UTC on January 1, 1970 (FW=1, PW=∞). -For formatting, it assumes UTC upon the absence of time zone offset.

-
Internal(InternalNumeric)

Internal uses only.

-

This item exists so that one can add additional internal-only formatting -without breaking major compatibility (as enum variants cannot be selectively private).

-

Trait Implementations

impl Clone for Numeric[src]

impl Debug for Numeric[src]

impl Eq for Numeric[src]

impl PartialEq<Numeric> for Numeric[src]

impl StructuralEq for Numeric[src]

impl StructuralPartialEq for Numeric[src]

Auto Trait Implementations

impl RefUnwindSafe for Numeric[src]

impl Send for Numeric[src]

impl Sync for Numeric[src]

impl Unpin for Numeric[src]

impl UnwindSafe for Numeric[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

-

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-
\ No newline at end of file diff --git a/docs/chrono/format/enum.Pad.html b/docs/chrono/format/enum.Pad.html deleted file mode 100644 index 14202ec9..00000000 --- a/docs/chrono/format/enum.Pad.html +++ /dev/null @@ -1,33 +0,0 @@ -chrono::format::Pad - Rust - -

[][src]Enum chrono::format::Pad

pub enum Pad {
-    None,
-    Zero,
-    Space,
-}

Padding characters for numeric items.

-

- Variants

-
None

No padding.

-
Zero

Zero (0) padding.

-
Space

Space padding.

-

Trait Implementations

impl Clone for Pad[src]

impl Copy for Pad[src]

impl Debug for Pad[src]

impl Eq for Pad[src]

impl PartialEq<Pad> for Pad[src]

impl StructuralEq for Pad[src]

impl StructuralPartialEq for Pad[src]

Auto Trait Implementations

impl RefUnwindSafe for Pad[src]

impl Send for Pad[src]

impl Sync for Pad[src]

impl Unpin for Pad[src]

impl UnwindSafe for Pad[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

-

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-
\ No newline at end of file diff --git a/docs/chrono/format/fn.format.html b/docs/chrono/format/fn.format.html deleted file mode 100644 index ebe92e84..00000000 --- a/docs/chrono/format/fn.format.html +++ /dev/null @@ -1,6 +0,0 @@ -chrono::format::format - Rust - -

[][src]Function chrono::format::format

pub fn format<'a, I, B>(
    w: &mut Formatter<'_>,
    date: Option<&NaiveDate>,
    time: Option<&NaiveTime>,
    off: Option<&(String, FixedOffset)>,
    items: I
) -> Result where
    I: Iterator<Item = B> + Clone,
    B: Borrow<Item<'a>>, 

Tries to format given arguments with given formatting items. -Internally used by DelayedFormat.

-
\ No newline at end of file diff --git a/docs/chrono/format/fn.format_item.html b/docs/chrono/format/fn.format_item.html deleted file mode 100644 index bbc5460d..00000000 --- a/docs/chrono/format/fn.format_item.html +++ /dev/null @@ -1,5 +0,0 @@ -chrono::format::format_item - Rust - -

[][src]Function chrono::format::format_item

pub fn format_item<'a>(
    w: &mut Formatter<'_>,
    date: Option<&NaiveDate>,
    time: Option<&NaiveTime>,
    off: Option<&(String, FixedOffset)>,
    item: &Item<'a>
) -> Result

Formats single formatting item

-
\ No newline at end of file diff --git a/docs/chrono/format/fn.parse.html b/docs/chrono/format/fn.parse.html deleted file mode 100644 index 0d98e629..00000000 --- a/docs/chrono/format/fn.parse.html +++ /dev/null @@ -1,24 +0,0 @@ -chrono::format::parse - Rust - -

[][src]Function chrono::format::parse

pub fn parse<'a, I, B>(
    parsed: &mut Parsed,
    s: &str,
    items: I
) -> ParseResult<()> where
    I: Iterator<Item = B>,
    B: Borrow<Item<'a>>, 

Tries to parse given string into parsed with given formatting items. -Returns Ok when the entire string has been parsed (otherwise parsed should not be used). -There should be no trailing string after parsing; -use a stray Item::Space to trim whitespaces.

-

This particular date and time parser is:

- -
\ No newline at end of file diff --git a/docs/chrono/format/index.html b/docs/chrono/format/index.html deleted file mode 100644 index f25766f0..00000000 --- a/docs/chrono/format/index.html +++ /dev/null @@ -1,41 +0,0 @@ -chrono::format - Rust - -

[][src]Module chrono::format

Formatting (and parsing) utilities for date and time.

-

This module provides the common types and routines to implement, -for example, DateTime::format or -DateTime::parse_from_str methods. -For most cases you should use these high-level interfaces.

-

Internally the formatting and parsing shares the same abstract formatting items, -which are just an Iterator of -the Item type. -They are generated from more readable format strings; -currently Chrono supports one built-in syntax closely resembling -C's strftime format.

-

Re-exports

-
pub use self::strftime::StrftimeItems;

Modules

-
strftime

strftime/strptime-inspired date and time formatting syntax.

-

Structs

-
DelayedFormat

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.

-
InternalFixed

An opaque type representing fixed-format item types for internal uses only.

-
InternalNumeric

An opaque type representing numeric item types for internal uses only.

-
ParseError

An error from the parse function.

-
Parsed

Parsed parts of date and time. There are two classes of methods:

-

Enums

-
Fixed

Fixed-format item types.

-
Item

A single formatting item. This is used for both formatting and parsing.

-
Numeric

Numeric item types. -They have associated formatting width (FW) and parsing width (PW).

-
Pad

Padding characters for numeric items.

-

Functions

-
format

Tries to format given arguments with given formatting items. -Internally used by DelayedFormat.

-
format_item

Formats single formatting item

-
parse

Tries to parse given string into parsed with given formatting items. -Returns Ok when the entire string has been parsed (otherwise parsed should not be used). -There should be no trailing string after parsing; -use a stray Item::Space to trim whitespaces.

-

Type Definitions

-
ParseResult

Same as Result<T, ParseError>.

-
\ No newline at end of file diff --git a/docs/chrono/format/parse/fn.parse.html b/docs/chrono/format/parse/fn.parse.html deleted file mode 100644 index 5cacb901..00000000 --- a/docs/chrono/format/parse/fn.parse.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -

Redirecting to ../../../chrono/format/fn.parse.html...

- - - \ No newline at end of file diff --git a/docs/chrono/format/parsed/struct.Parsed.html b/docs/chrono/format/parsed/struct.Parsed.html deleted file mode 100644 index 922046fc..00000000 --- a/docs/chrono/format/parsed/struct.Parsed.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -

Redirecting to ../../../chrono/format/struct.Parsed.html...

- - - \ No newline at end of file diff --git a/docs/chrono/format/sidebar-items.js b/docs/chrono/format/sidebar-items.js deleted file mode 100644 index 3e16119b..00000000 --- a/docs/chrono/format/sidebar-items.js +++ /dev/null @@ -1 +0,0 @@ -initSidebarItems({"enum":[["Fixed","Fixed-format item types."],["Item","A single formatting item. This is used for both formatting and parsing."],["Numeric","Numeric item types. They have associated formatting width (FW) and parsing width (PW)."],["Pad","Padding characters for numeric items."]],"fn":[["format","Tries to format given arguments with given formatting items. Internally used by `DelayedFormat`."],["format_item","Formats single formatting item"],["parse","Tries to parse given string into `parsed` with given formatting items. Returns `Ok` when the entire string has been parsed (otherwise `parsed` should not be used). There should be no trailing string after parsing; use a stray `Item::Space` to trim whitespaces."]],"mod":[["strftime","`strftime`/`strptime`-inspired date and time formatting syntax."]],"struct":[["DelayedFormat","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."],["InternalFixed","An opaque type representing fixed-format item types for internal uses only."],["InternalNumeric","An opaque type representing numeric item types for internal uses only."],["ParseError","An error from the `parse` function."],["Parsed","Parsed parts of date and time. There are two classes of methods:"]],"type":[["ParseResult","Same as `Result`."]]}); \ No newline at end of file diff --git a/docs/chrono/format/strftime/index.html b/docs/chrono/format/strftime/index.html deleted file mode 100644 index 9ccea01e..00000000 --- a/docs/chrono/format/strftime/index.html +++ /dev/null @@ -1,146 +0,0 @@ -chrono::format::strftime - Rust - -

[][src]Module chrono::format::strftime

strftime/strptime-inspired date and time formatting syntax.

-

Specifiers

-

The following specifiers are available both to formatting and parsing.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Spec.ExampleDescription
DATE SPECIFIERS:
%Y2001The full proleptic Gregorian year, zero-padded to 4 digits. 1
%C20The proleptic Gregorian year divided by 100, zero-padded to 2 digits. 2
%y01The proleptic Gregorian year modulo 100, zero-padded to 2 digits. 2
%m07Month number (01--12), zero-padded to 2 digits.
%bJulAbbreviated month name. Always 3 letters.
%BJulyFull month name. Also accepts corresponding abbreviation in parsing.
%hJulSame as %b.
%d08Day number (01--31), zero-padded to 2 digits.
%e 8Same as %d but space-padded. Same as %_d.
%aSunAbbreviated weekday name. Always 3 letters.
%ASundayFull weekday name. Also accepts corresponding abbreviation in parsing.
%w0Sunday = 0, Monday = 1, ..., Saturday = 6.
%u7Monday = 1, Tuesday = 2, ..., Sunday = 7. (ISO 8601)
%U28Week number starting with Sunday (00--53), zero-padded to 2 digits. 3
%W27Same as %U, but week 1 starts with the first Monday in that year instead.
%G2001Same as %Y but uses the year number in ISO 8601 week date. 4
%g01Same as %y but uses the year number in ISO 8601 week date. 4
%V27Same as %U but uses the week number in ISO 8601 week date (01--53). 4
%j189Day of the year (001--366), zero-padded to 3 digits.
%D07/08/01Month-day-year format. Same as %m/%d/%y.
%x07/08/01Locale's date representation (e.g., 12/31/99).
%F2001-07-08Year-month-day format (ISO 8601). Same as %Y-%m-%d.
%v 8-Jul-2001Day-month-year format. Same as %e-%b-%Y.
TIME SPECIFIERS:
%H00Hour number (00--23), zero-padded to 2 digits.
%k 0Same as %H but space-padded. Same as %_H.
%I12Hour number in 12-hour clocks (01--12), zero-padded to 2 digits.
%l12Same as %I but space-padded. Same as %_I.
%Pamam or pm in 12-hour clocks.
%pAMAM or PM in 12-hour clocks.
%M34Minute number (00--59), zero-padded to 2 digits.
%S60Second number (00--60), zero-padded to 2 digits. 5
%f026490000The fractional seconds (in nanoseconds) since last whole second. 6
%.f.026490Similar to .%f but left-aligned. These all consume the leading dot. 6
%.3f.026Similar to .%f but left-aligned but fixed to a length of 3. 6
%.6f.026490Similar to .%f but left-aligned but fixed to a length of 6. 6
%.9f.026490000Similar to .%f but left-aligned but fixed to a length of 9. 6
%3f026Similar to %.3f but without the leading dot. 6
%6f026490Similar to %.6f but without the leading dot. 6
%9f026490000Similar to %.9f but without the leading dot. 6
%R00:34Hour-minute format. Same as %H:%M.
%T00:34:60Hour-minute-second format. Same as %H:%M:%S.
%X00:34:60Locale's time representation (e.g., 23:13:48).
%r12:34:60 AMHour-minute-second format in 12-hour clocks. Same as %I:%M:%S %p.
TIME ZONE SPECIFIERS:
%ZACSTLocal time zone name. Skips all non-whitespace characters during parsing. 7
%z+0930Offset from the local time to UTC (with UTC being +0000).
%:z+09:30Same as %z but with a colon.
%#z+09Parsing only: Same as %z but allows minutes to be missing or present.
DATE & TIME SPECIFIERS:
%cSun Jul 8 00:34:60 2001Locale's date and time (e.g., Thu Mar 3 23:05:25 2005).
%+2001-07-08T00:34:60.026490+09:30ISO 8601 / RFC 3339 date & time format. 8
%s994518299UNIX timestamp, the number of seconds since 1970-01-01 00:00 UTC. 9
SPECIAL SPECIFIERS:
%tLiteral tab (\t).
%nLiteral newline (\n).
%%Literal percent sign.
-

It is possible to override the default padding behavior of numeric specifiers %?. -This is not allowed for other specifiers and will result in the BAD_FORMAT error.

- - - - -
ModifierDescription
%-?Suppresses any padding including spaces and zeroes. (e.g. %j = 012, %-j = 12)
%_?Uses spaces as a padding. (e.g. %j = 012, %_j = 12)
%0?Uses zeroes as a padding. (e.g. %e = 9, %0e = 09)
-

Notes:

-

  1. %Y: -Negative years are allowed in formatting but not in parsing. 

  2. %C, %y: -This is floor division, so 100 BCE (year number -99) will print -1 and 99 respectively. 

  3. %U: -Week 1 starts with the first Sunday in that year. -It is possible to have week 0 for days before the first Sunday. 

  4. %G, %g, %V: -Week 1 is the first week with at least 4 days in that year. -Week 0 does not exist, so this should be used with %G or %g

  5. %S: -It accounts for leap seconds, so 60 is possible. 

  6. %f, %.f, %.3f, %.6f, %.9f, %3f, %6f, %9f: -
    -The default %f is right-aligned and always zero-padded to 9 digits -for the compatibility with glibc and others, -so it always counts the number of nanoseconds since the last whole second. -E.g. 7ms after the last second will print 007000000, -and parsing 7000000 will yield the same. -
    -
    -The variant %.f is left-aligned and print 0, 3, 6 or 9 fractional digits -according to the precision. -E.g. 70ms after the last second under %.f will print .070 (note: not .07), -and parsing .07, .070000 etc. will yield the same. -Note that they can print or read nothing if the fractional part is zero or -the next character is not .. -
    -
    -The variant %.3f, %.6f and %.9f are left-aligned and print 3, 6 or 9 fractional digits -according to the number preceding f. -E.g. 70ms after the last second under %.3f will print .070 (note: not .07), -and parsing .07, .070000 etc. will yield the same. -Note that they can read nothing if the fractional part is zero or -the next character is not . however will print with the specified length. -
    -
    -The variant %3f, %6f and %9f are left-aligned and print 3, 6 or 9 fractional digits -according to the number preceding f, but without the leading dot. -E.g. 70ms after the last second under %3f will print 070 (note: not 07), -and parsing 07, 070000 etc. will yield the same. -Note that they can read nothing if the fractional part is zero. 

  7. %Z: -Offset will not be populated from the parsed data, nor will it be validated. -Timezone is completely ignored. Similar to the glibc strptime treatment of -this format code. -
    -
    -It is not possible to reliably convert from an abbreviation to an offset, -for example CDT can mean either Central Daylight Time (North America) or -China Daylight Time. 

  8. %+: Same as %Y-%m-%dT%H:%M:%S%.f%:z, i.e. 0, 3, 6 or 9 fractional -digits for seconds and colons in the time zone offset. -
    -
    -The typical strftime implementations have different (and locale-dependent) -formats for this specifier. While Chrono's format for %+ is far more -stable, it is best to avoid this specifier if you want to control the exact -output. 

  9. %s: -This is not padded and can be negative. -For the purpose of Chrono, it only accounts for non-leap seconds -so it slightly differs from ISO C strftime behavior. 

Structs

-
StrftimeItems

Parsing iterator for strftime-like format strings.

-
\ No newline at end of file diff --git a/docs/chrono/format/strftime/sidebar-items.js b/docs/chrono/format/strftime/sidebar-items.js deleted file mode 100644 index 5b72d220..00000000 --- a/docs/chrono/format/strftime/sidebar-items.js +++ /dev/null @@ -1 +0,0 @@ -initSidebarItems({"struct":[["StrftimeItems","Parsing iterator for `strftime`-like format strings."]]}); \ No newline at end of file diff --git a/docs/chrono/format/strftime/struct.StrftimeItems.html b/docs/chrono/format/strftime/struct.StrftimeItems.html deleted file mode 100644 index c3402fe9..00000000 --- a/docs/chrono/format/strftime/struct.StrftimeItems.html +++ /dev/null @@ -1,136 +0,0 @@ -chrono::format::strftime::StrftimeItems - Rust - -

[][src]Struct chrono::format::strftime::StrftimeItems

pub struct StrftimeItems<'a> { /* fields omitted */ }

Parsing iterator for strftime-like format strings.

-

Implementations

impl<'a> StrftimeItems<'a>[src]

pub fn new(s: &'a str) -> StrftimeItems<'a>

Notable traits for StrftimeItems<'a>

impl<'a> Iterator for StrftimeItems<'a> type Item = Item<'a>;
[src]

Creates a new parsing iterator from the strftime-like format string.

-

Trait Implementations

impl<'a> Clone for StrftimeItems<'a>[src]

impl<'a> Debug for StrftimeItems<'a>[src]

impl<'a> Iterator for StrftimeItems<'a>[src]

type Item = Item<'a>

The type of the elements being iterated over.

-

Auto Trait Implementations

impl<'a> RefUnwindSafe for StrftimeItems<'a>[src]

impl<'a> Send for StrftimeItems<'a>[src]

impl<'a> Sync for StrftimeItems<'a>[src]

impl<'a> Unpin for StrftimeItems<'a>[src]

impl<'a> UnwindSafe for StrftimeItems<'a>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

-

type IntoIter = I

Which kind of iterator are we turning this into?

-

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

-

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-
\ No newline at end of file diff --git a/docs/chrono/format/struct.DelayedFormat.html b/docs/chrono/format/struct.DelayedFormat.html deleted file mode 100644 index 128be4f9..00000000 --- a/docs/chrono/format/struct.DelayedFormat.html +++ /dev/null @@ -1,20 +0,0 @@ -chrono::format::DelayedFormat - Rust - -

[][src]Struct chrono::format::DelayedFormat

pub struct DelayedFormat<I> { /* fields omitted */ }

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.

-

Implementations

impl<'a, I: Iterator<Item = B> + Clone, B: Borrow<Item<'a>>> DelayedFormat<I>[src]

pub fn new(
    date: Option<NaiveDate>,
    time: Option<NaiveTime>,
    items: I
) -> DelayedFormat<I>
[src]

Makes a new DelayedFormat value out of local date and time.

-

pub fn new_with_offset<Off>(
    date: Option<NaiveDate>,
    time: Option<NaiveTime>,
    offset: &Off,
    items: I
) -> DelayedFormat<I> where
    Off: Offset + Display
[src]

Makes a new DelayedFormat value out of local date and time and UTC offset.

-

Trait Implementations

impl<I: Debug> Debug for DelayedFormat<I>[src]

impl<'a, I: Iterator<Item = B> + Clone, B: Borrow<Item<'a>>> Display for DelayedFormat<I>[src]

Auto Trait Implementations

impl<I> RefUnwindSafe for DelayedFormat<I> where
    I: RefUnwindSafe
[src]

impl<I> Send for DelayedFormat<I> where
    I: Send
[src]

impl<I> Sync for DelayedFormat<I> where
    I: Sync
[src]

impl<I> Unpin for DelayedFormat<I> where
    I: Unpin
[src]

impl<I> UnwindSafe for DelayedFormat<I> where
    I: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-
\ No newline at end of file diff --git a/docs/chrono/format/struct.InternalFixed.html b/docs/chrono/format/struct.InternalFixed.html deleted file mode 100644 index 80ae714a..00000000 --- a/docs/chrono/format/struct.InternalFixed.html +++ /dev/null @@ -1,24 +0,0 @@ -chrono::format::InternalFixed - Rust - -

[][src]Struct chrono::format::InternalFixed

pub struct InternalFixed { /* fields omitted */ }

An opaque type representing fixed-format item types for internal uses only.

-

Trait Implementations

impl Clone for InternalFixed[src]

impl Debug for InternalFixed[src]

impl Eq for InternalFixed[src]

impl PartialEq<InternalFixed> for InternalFixed[src]

impl StructuralEq for InternalFixed[src]

impl StructuralPartialEq for InternalFixed[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

-

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-
\ No newline at end of file diff --git a/docs/chrono/format/struct.InternalNumeric.html b/docs/chrono/format/struct.InternalNumeric.html deleted file mode 100644 index 58bcc71a..00000000 --- a/docs/chrono/format/struct.InternalNumeric.html +++ /dev/null @@ -1,24 +0,0 @@ -chrono::format::InternalNumeric - Rust - -

[][src]Struct chrono::format::InternalNumeric

pub struct InternalNumeric { /* fields omitted */ }

An opaque type representing numeric item types for internal uses only.

-

Trait Implementations

impl Clone for InternalNumeric[src]

impl Debug for InternalNumeric[src]

impl Eq for InternalNumeric[src]

impl PartialEq<InternalNumeric> for InternalNumeric[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

-

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-
\ No newline at end of file diff --git a/docs/chrono/format/struct.ParseError.html b/docs/chrono/format/struct.ParseError.html deleted file mode 100644 index 8c4d2336..00000000 --- a/docs/chrono/format/struct.ParseError.html +++ /dev/null @@ -1,30 +0,0 @@ -chrono::format::ParseError - Rust - -

[][src]Struct chrono::format::ParseError

pub struct ParseError(_);

An error from the parse function.

-

Trait Implementations

impl Clone for ParseError[src]

impl Copy for ParseError[src]

impl Debug for ParseError[src]

impl Display for ParseError[src]

impl Eq for ParseError[src]

impl Error for ParseError[src]

impl PartialEq<ParseError> for ParseError[src]

impl StructuralEq for ParseError[src]

impl StructuralPartialEq for ParseError[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

-

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-
\ No newline at end of file diff --git a/docs/chrono/format/struct.Parsed.html b/docs/chrono/format/struct.Parsed.html deleted file mode 100644 index 1b7e198f..00000000 --- a/docs/chrono/format/struct.Parsed.html +++ /dev/null @@ -1,157 +0,0 @@ -chrono::format::Parsed - Rust - -

[][src]Struct chrono::format::Parsed

pub struct Parsed {
-    pub year: Option<i32>,
-    pub year_div_100: Option<i32>,
-    pub year_mod_100: Option<i32>,
-    pub isoyear: Option<i32>,
-    pub isoyear_div_100: Option<i32>,
-    pub isoyear_mod_100: Option<i32>,
-    pub month: Option<u32>,
-    pub week_from_sun: Option<u32>,
-    pub week_from_mon: Option<u32>,
-    pub isoweek: Option<u32>,
-    pub weekday: Option<Weekday>,
-    pub ordinal: Option<u32>,
-    pub day: Option<u32>,
-    pub hour_div_12: Option<u32>,
-    pub hour_mod_12: Option<u32>,
-    pub minute: Option<u32>,
-    pub second: Option<u32>,
-    pub nanosecond: Option<u32>,
-    pub timestamp: Option<i64>,
-    pub offset: Option<i32>,
-    // some fields omitted
-}

Parsed parts of date and time. There are two classes of methods:

-
    -
  • -

    set_* methods try to set given field(s) while checking for the consistency. -It may or may not check for the range constraint immediately (for efficiency reasons).

    -
  • -
  • -

    to_* methods try to make a concrete date and time value out of set fields. -It fully checks any remaining out-of-range conditions and inconsistent/impossible fields.

    -
  • -
-

- Fields

year: Option<i32>

Year.

-

This can be negative unlike year_div_100 -and year_mod_100 fields.

-
year_div_100: Option<i32>

Year divided by 100. Implies that the year is >= 1 BCE when set.

-

Due to the common usage, if this field is missing but -year_mod_100 is present, -it is inferred to 19 when year_mod_100 >= 70 and 20 otherwise.

-
year_mod_100: Option<i32>

Year modulo 100. Implies that the year is >= 1 BCE when set.

-
isoyear: Option<i32>

Year in the ISO week date.

-

This can be negative unlike isoyear_div_100 and -isoyear_mod_100 fields.

-
isoyear_div_100: Option<i32>

Year in the ISO week date, divided by 100. -Implies that the year is >= 1 BCE when set.

-

Due to the common usage, if this field is missing but -isoyear_mod_100 is present, -it is inferred to 19 when isoyear_mod_100 >= 70 and 20 otherwise.

-
isoyear_mod_100: Option<i32>

Year in the ISO week date, modulo 100. -Implies that the year is >= 1 BCE when set.

-
month: Option<u32>

Month (1--12).

-
week_from_sun: Option<u32>

Week number, where the week 1 starts at the first Sunday of January -(0--53, 1--53 or 1--52 depending on the year).

-
week_from_mon: Option<u32>

Week number, where the week 1 starts at the first Monday of January -(0--53, 1--53 or 1--52 depending on the year).

-
isoweek: Option<u32>

ISO week number -(1--52 or 1--53 depending on the year).

-
weekday: Option<Weekday>

Day of the week.

-
ordinal: Option<u32>

Day of the year (1--365 or 1--366 depending on the year).

-
day: Option<u32>

Day of the month (1--28, 1--29, 1--30 or 1--31 depending on the month).

-
hour_div_12: Option<u32>

Hour number divided by 12 (0--1). 0 indicates AM and 1 indicates PM.

-
hour_mod_12: Option<u32>

Hour number modulo 12 (0--11).

-
minute: Option<u32>

Minute number (0--59).

-
second: Option<u32>

Second number (0--60, accounting for leap seconds).

-
nanosecond: Option<u32>

The number of nanoseconds since the whole second (0--999,999,999).

-
timestamp: Option<i64>

The number of non-leap seconds since the midnight UTC on January 1, 1970.

-

This can be off by one if second is 60 (a leap second).

-
offset: Option<i32>

Offset from the local time to UTC, in seconds.

-

Implementations

impl Parsed[src]

pub fn new() -> Parsed[src]

Returns the initial value of parsed parts.

-

pub fn set_year(&mut self, value: i64) -> ParseResult<()>[src]

Tries to set the year field from given value.

-

pub fn set_year_div_100(&mut self, value: i64) -> ParseResult<()>[src]

Tries to set the year_div_100 field from given value.

-

pub fn set_year_mod_100(&mut self, value: i64) -> ParseResult<()>[src]

Tries to set the year_mod_100 field from given value.

-

pub fn set_isoyear(&mut self, value: i64) -> ParseResult<()>[src]

Tries to set the isoyear field from given value.

-

pub fn set_isoyear_div_100(&mut self, value: i64) -> ParseResult<()>[src]

Tries to set the isoyear_div_100 field from given value.

-

pub fn set_isoyear_mod_100(&mut self, value: i64) -> ParseResult<()>[src]

Tries to set the isoyear_mod_100 field from given value.

-

pub fn set_month(&mut self, value: i64) -> ParseResult<()>[src]

Tries to set the month field from given value.

-

pub fn set_week_from_sun(&mut self, value: i64) -> ParseResult<()>[src]

Tries to set the week_from_sun field from given value.

-

pub fn set_week_from_mon(&mut self, value: i64) -> ParseResult<()>[src]

Tries to set the week_from_mon field from given value.

-

pub fn set_isoweek(&mut self, value: i64) -> ParseResult<()>[src]

Tries to set the isoweek field from given value.

-

pub fn set_weekday(&mut self, value: Weekday) -> ParseResult<()>[src]

Tries to set the weekday field from given value.

-

pub fn set_ordinal(&mut self, value: i64) -> ParseResult<()>[src]

Tries to set the ordinal field from given value.

-

pub fn set_day(&mut self, value: i64) -> ParseResult<()>[src]

Tries to set the day field from given value.

-

pub fn set_ampm(&mut self, value: bool) -> ParseResult<()>[src]

Tries to set the hour_div_12 field from given value. -(false for AM, true for PM)

-

pub fn set_hour12(&mut self, value: i64) -> ParseResult<()>[src]

Tries to set the hour_mod_12 field from -given hour number in 12-hour clocks.

-

pub fn set_hour(&mut self, value: i64) -> ParseResult<()>[src]

Tries to set both hour_div_12 and -hour_mod_12 fields from given value.

-

pub fn set_minute(&mut self, value: i64) -> ParseResult<()>[src]

Tries to set the minute field from given value.

-

pub fn set_second(&mut self, value: i64) -> ParseResult<()>[src]

Tries to set the second field from given value.

-

pub fn set_nanosecond(&mut self, value: i64) -> ParseResult<()>[src]

Tries to set the nanosecond field from given value.

-

pub fn set_timestamp(&mut self, value: i64) -> ParseResult<()>[src]

Tries to set the timestamp field from given value.

-

pub fn set_offset(&mut self, value: i64) -> ParseResult<()>[src]

Tries to set the offset field from given value.

-

pub fn to_naive_date(&self) -> ParseResult<NaiveDate>[src]

Returns a parsed naive date out of given fields.

-

This method is able to determine the date from given subset of fields:

-
    -
  • Year, month, day.
  • -
  • Year, day of the year (ordinal).
  • -
  • Year, week number counted from Sunday or Monday, day of the week.
  • -
  • ISO week date.
  • -
-

Gregorian year and ISO week date year can have their century number (*_div_100) omitted, -the two-digit year is used to guess the century number then.

-

pub fn to_naive_time(&self) -> ParseResult<NaiveTime>[src]

Returns a parsed naive time out of given fields.

-

This method is able to determine the time from given subset of fields:

-
    -
  • Hour, minute. (second and nanosecond assumed to be 0)
  • -
  • Hour, minute, second. (nanosecond assumed to be 0)
  • -
  • Hour, minute, second, nanosecond.
  • -
-

It is able to handle leap seconds when given second is 60.

-

pub fn to_naive_datetime_with_offset(
    &self,
    offset: i32
) -> ParseResult<NaiveDateTime>
[src]

Returns a parsed naive date and time out of given fields, -except for the offset field (assumed to have a given value). -This is required for parsing a local time or other known-timezone inputs.

-

This method is able to determine the combined date and time -from date and time fields or a single timestamp field. -Either way those fields have to be consistent to each other.

-

pub fn to_fixed_offset(&self) -> ParseResult<FixedOffset>[src]

Returns a parsed fixed time zone offset out of given fields.

-

pub fn to_datetime(&self) -> ParseResult<DateTime<FixedOffset>>[src]

Returns a parsed timezone-aware date and time out of given fields.

-

This method is able to determine the combined date and time -from date and time fields or a single timestamp field, -plus a time zone offset. -Either way those fields have to be consistent to each other.

-

pub fn to_datetime_with_timezone<Tz: TimeZone>(
    &self,
    tz: &Tz
) -> ParseResult<DateTime<Tz>>
[src]

Returns a parsed timezone-aware date and time out of given fields, -with an additional TimeZone used to interpret and validate the local date.

-

This method is able to determine the combined date and time -from date and time fields or a single timestamp field, -plus a time zone offset. -Either way those fields have to be consistent to each other. -If parsed fields include an UTC offset, it also has to be consistent to -offset.

-

Trait Implementations

impl Clone for Parsed[src]

impl Debug for Parsed[src]

impl Default for Parsed[src]

impl PartialEq<Parsed> for Parsed[src]

impl StructuralPartialEq for Parsed[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

-

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-
\ No newline at end of file diff --git a/docs/chrono/format/type.ParseResult.html b/docs/chrono/format/type.ParseResult.html deleted file mode 100644 index 85b0cb4e..00000000 --- a/docs/chrono/format/type.ParseResult.html +++ /dev/null @@ -1,5 +0,0 @@ -chrono::format::ParseResult - Rust - -

[][src]Type Definition chrono::format::ParseResult

type ParseResult<T> = Result<T, ParseError>;

Same as Result<T, ParseError>.

-
\ No newline at end of file diff --git a/docs/chrono/index.html b/docs/chrono/index.html deleted file mode 100644 index a8049dec..00000000 --- a/docs/chrono/index.html +++ /dev/null @@ -1,386 +0,0 @@ -chrono - Rust - -

[][src]Crate chrono

Chrono: Date and Time for Rust

-

It aims to be a feature-complete superset of -the time library. -In particular,

-
    -
  • Chrono strictly adheres to ISO 8601.
  • -
  • Chrono is timezone-aware by default, with separate timezone-naive types.
  • -
  • Chrono is space-optimal and (while not being the primary goal) reasonably efficient.
  • -
-

There were several previous attempts to bring a good date and time library to Rust, -which Chrono builds upon and should acknowledge:

- -

Any significant changes to Chrono are documented in -the CHANGELOG.md file.

-

Usage

-

Put this in your Cargo.toml:

-
[dependencies]
-chrono = "0.4"
-
-

Features

-

Chrono supports various runtime environments and operating systems, and has -several features that may be enabled or disabled.

-

Default features:

-
    -
  • alloc: Enable features that depend on allocation (primarily string formatting)
  • -
  • std: Enables functionality that depends on the standard library. This -is a superset of alloc and adds interoperation with standard library types -and traits.
  • -
  • clock: enables reading the system time (now), independent of whether -std::time::SystemTime is present, depends on having a libc.
  • -
-

Optional features:

-
    -
  • wasmbind: Enable integration with wasm-bindgen and its js-sys project
  • -
  • serde: Enable serialization/deserialization via serde.
  • -
  • unstable-locales: Enable localization. This adds various methods with a -_localized suffix. The implementation and API may change or even be -removed in a patch release. Feedback welcome.
  • -
-

See the cargo docs for examples of specifying features.

-

Overview

Duration

-

Chrono currently uses its own Duration type to represent the magnitude -of a time span. Since this has the same name as the newer, standard type for -duration, the reference will refer this type as OldDuration.

-

Note that this is an "accurate" duration represented as seconds and -nanoseconds and does not represent "nominal" components such as days or -months.

-

When the oldtime feature is enabled, Duration is an alias for the -time::Duration -type from v0.1 of the time crate. time v0.1 is deprecated, so new code -should disable the oldtime feature and use the chrono::Duration type -instead. The oldtime feature is enabled by default for backwards -compatibility, but future versions of Chrono are likely to remove the -feature entirely.

-

Chrono does not yet natively support -the standard Duration type, -but it will be supported in the future. -Meanwhile you can convert between two types with -Duration::from_std -and -Duration::to_std -methods.

-

Date and Time

-

Chrono provides a -DateTime -type to represent a date and a time in a timezone.

-

For more abstract moment-in-time tracking such as internal timekeeping -that is unconcerned with timezones, consider -time::SystemTime, -which tracks your system clock, or -time::Instant, which -is an opaque but monotonically-increasing representation of a moment in time.

-

DateTime is timezone-aware and must be constructed from -the TimeZone object, -which defines how the local date is converted to and back from the UTC date. -There are three well-known TimeZone implementations:

-
    -
  • -

    Utc specifies the UTC time zone. It is most efficient.

    -
  • -
  • -

    Local specifies the system local time zone.

    -
  • -
  • -

    FixedOffset specifies -an arbitrary, fixed time zone such as UTC+09:00 or UTC-10:30. -This often results from the parsed textual date and time. -Since it stores the most information and does not depend on the system environment, -you would want to normalize other TimeZones into this type.

    -
  • -
-

DateTimes with different TimeZone types are distinct and do not mix, -but can be converted to each other using -the DateTime::with_timezone method.

-

You can get the current date and time in the UTC time zone -(Utc::now()) -or in the local time zone -(Local::now()).

- -
-use chrono::prelude::*;
-
-let utc: DateTime<Utc> = Utc::now();       // e.g. `2014-11-28T12:45:59.324310806Z`
-let local: DateTime<Local> = Local::now(); // e.g. `2014-11-28T21:45:59.324310806+09:00`
-

Alternatively, you can create your own date and time. -This is a bit verbose due to Rust's lack of function and method overloading, -but in turn we get a rich combination of initialization methods.

- -
-use chrono::prelude::*;
-use chrono::offset::LocalResult;
-
-let dt = Utc.ymd(2014, 7, 8).and_hms(9, 10, 11); // `2014-07-08T09:10:11Z`
-// July 8 is 188th day of the year 2014 (`o` for "ordinal")
-assert_eq!(dt, Utc.yo(2014, 189).and_hms(9, 10, 11));
-// July 8 is Tuesday in ISO week 28 of the year 2014.
-assert_eq!(dt, Utc.isoywd(2014, 28, Weekday::Tue).and_hms(9, 10, 11));
-
-let dt = Utc.ymd(2014, 7, 8).and_hms_milli(9, 10, 11, 12); // `2014-07-08T09:10:11.012Z`
-assert_eq!(dt, Utc.ymd(2014, 7, 8).and_hms_micro(9, 10, 11, 12_000));
-assert_eq!(dt, Utc.ymd(2014, 7, 8).and_hms_nano(9, 10, 11, 12_000_000));
-
-// dynamic verification
-assert_eq!(Utc.ymd_opt(2014, 7, 8).and_hms_opt(21, 15, 33),
-           LocalResult::Single(Utc.ymd(2014, 7, 8).and_hms(21, 15, 33)));
-assert_eq!(Utc.ymd_opt(2014, 7, 8).and_hms_opt(80, 15, 33), LocalResult::None);
-assert_eq!(Utc.ymd_opt(2014, 7, 38).and_hms_opt(21, 15, 33), LocalResult::None);
-
-// other time zone objects can be used to construct a local datetime.
-// obviously, `local_dt` is normally different from `dt`, but `fixed_dt` should be identical.
-let local_dt = Local.ymd(2014, 7, 8).and_hms_milli(9, 10, 11, 12);
-let fixed_dt = FixedOffset::east(9 * 3600).ymd(2014, 7, 8).and_hms_milli(18, 10, 11, 12);
-assert_eq!(dt, fixed_dt);
-

Various properties are available to the date and time, and can be altered individually. -Most of them are defined in the traits Datelike and -Timelike which you should use before. -Addition and subtraction is also supported. -The following illustrates most supported operations to the date and time:

- -
-
-use chrono::prelude::*;
-use chrono::Duration;
-
-// assume this returned `2014-11-28T21:45:59.324310806+09:00`:
-let dt = FixedOffset::east(9*3600).ymd(2014, 11, 28).and_hms_nano(21, 45, 59, 324310806);
-
-// property accessors
-assert_eq!((dt.year(), dt.month(), dt.day()), (2014, 11, 28));
-assert_eq!((dt.month0(), dt.day0()), (10, 27)); // for unfortunate souls
-assert_eq!((dt.hour(), dt.minute(), dt.second()), (21, 45, 59));
-assert_eq!(dt.weekday(), Weekday::Fri);
-assert_eq!(dt.weekday().number_from_monday(), 5); // Mon=1, ..., Sun=7
-assert_eq!(dt.ordinal(), 332); // the day of year
-assert_eq!(dt.num_days_from_ce(), 735565); // the number of days from and including Jan 1, 1
-
-// time zone accessor and manipulation
-assert_eq!(dt.offset().fix().local_minus_utc(), 9 * 3600);
-assert_eq!(dt.timezone(), FixedOffset::east(9 * 3600));
-assert_eq!(dt.with_timezone(&Utc), Utc.ymd(2014, 11, 28).and_hms_nano(12, 45, 59, 324310806));
-
-// a sample of property manipulations (validates dynamically)
-assert_eq!(dt.with_day(29).unwrap().weekday(), Weekday::Sat); // 2014-11-29 is Saturday
-assert_eq!(dt.with_day(32), None);
-assert_eq!(dt.with_year(-300).unwrap().num_days_from_ce(), -109606); // November 29, 301 BCE
-
-// arithmetic operations
-let dt1 = Utc.ymd(2014, 11, 14).and_hms(8, 9, 10);
-let dt2 = Utc.ymd(2014, 11, 14).and_hms(10, 9, 8);
-assert_eq!(dt1.signed_duration_since(dt2), Duration::seconds(-2 * 3600 + 2));
-assert_eq!(dt2.signed_duration_since(dt1), Duration::seconds(2 * 3600 - 2));
-assert_eq!(Utc.ymd(1970, 1, 1).and_hms(0, 0, 0) + Duration::seconds(1_000_000_000),
-           Utc.ymd(2001, 9, 9).and_hms(1, 46, 40));
-assert_eq!(Utc.ymd(1970, 1, 1).and_hms(0, 0, 0) - Duration::seconds(1_000_000_000),
-           Utc.ymd(1938, 4, 24).and_hms(22, 13, 20));
-

Formatting and Parsing

-

Formatting is done via the format method, -which format is equivalent to the familiar strftime format.

-

See format::strftime -documentation for full syntax and list of specifiers.

-

The default to_string method and {:?} specifier also give a reasonable representation. -Chrono also provides to_rfc2822 and -to_rfc3339 methods -for well-known formats.

-

Chrono now also provides date formatting in almost any language without the -help of an additional C library. This functionality is under the feature -unstable-locales:

-
chrono { version = "0.4", features = ["unstable-locales"]
-
-

The unstable-locales feature requires and implies at least the alloc feature.

- -
-use chrono::prelude::*;
-
-let dt = Utc.ymd(2014, 11, 28).and_hms(12, 0, 9);
-assert_eq!(dt.format("%Y-%m-%d %H:%M:%S").to_string(), "2014-11-28 12:00:09");
-assert_eq!(dt.format("%a %b %e %T %Y").to_string(), "Fri Nov 28 12:00:09 2014");
-assert_eq!(dt.format_localized("%A %e %B %Y, %T", Locale::fr_BE).to_string(), "vendredi 28 novembre 2014, 12:00:09");
-assert_eq!(dt.format("%a %b %e %T %Y").to_string(), dt.format("%c").to_string());
-
-assert_eq!(dt.to_string(), "2014-11-28 12:00:09 UTC");
-assert_eq!(dt.to_rfc2822(), "Fri, 28 Nov 2014 12:00:09 +0000");
-assert_eq!(dt.to_rfc3339(), "2014-11-28T12:00:09+00:00");
-assert_eq!(format!("{:?}", dt), "2014-11-28T12:00:09Z");
-
-// Note that milli/nanoseconds are only printed if they are non-zero
-let dt_nano = Utc.ymd(2014, 11, 28).and_hms_nano(12, 0, 9, 1);
-assert_eq!(format!("{:?}", dt_nano), "2014-11-28T12:00:09.000000001Z");
-

Parsing can be done with three methods:

-
    -
  1. -

    The standard FromStr trait -(and parse method -on a string) can be used for parsing DateTime<FixedOffset>, DateTime<Utc> and -DateTime<Local> values. This parses what the {:?} -(std::fmt::Debug) -format specifier prints, and requires the offset to be present.

    -
  2. -
  3. -

    DateTime::parse_from_str parses -a date and time with offsets and returns DateTime<FixedOffset>. -This should be used when the offset is a part of input and the caller cannot guess that. -It cannot be used when the offset can be missing. -DateTime::parse_from_rfc2822 -and -DateTime::parse_from_rfc3339 -are similar but for well-known formats.

    -
  4. -
  5. -

    Offset::datetime_from_str is -similar but returns DateTime of given offset. -When the explicit offset is missing from the input, it simply uses given offset. -It issues an error when the input contains an explicit offset different -from the current offset.

    -
  6. -
-

More detailed control over the parsing process is available via -format module.

- -
-use chrono::prelude::*;
-
-let dt = Utc.ymd(2014, 11, 28).and_hms(12, 0, 9);
-let fixed_dt = dt.with_timezone(&FixedOffset::east(9*3600));
-
-// method 1
-assert_eq!("2014-11-28T12:00:09Z".parse::<DateTime<Utc>>(), Ok(dt.clone()));
-assert_eq!("2014-11-28T21:00:09+09:00".parse::<DateTime<Utc>>(), Ok(dt.clone()));
-assert_eq!("2014-11-28T21:00:09+09:00".parse::<DateTime<FixedOffset>>(), Ok(fixed_dt.clone()));
-
-// method 2
-assert_eq!(DateTime::parse_from_str("2014-11-28 21:00:09 +09:00", "%Y-%m-%d %H:%M:%S %z"),
-           Ok(fixed_dt.clone()));
-assert_eq!(DateTime::parse_from_rfc2822("Fri, 28 Nov 2014 21:00:09 +0900"),
-           Ok(fixed_dt.clone()));
-assert_eq!(DateTime::parse_from_rfc3339("2014-11-28T21:00:09+09:00"), Ok(fixed_dt.clone()));
-
-// method 3
-assert_eq!(Utc.datetime_from_str("2014-11-28 12:00:09", "%Y-%m-%d %H:%M:%S"), Ok(dt.clone()));
-assert_eq!(Utc.datetime_from_str("Fri Nov 28 12:00:09 2014", "%a %b %e %T %Y"), Ok(dt.clone()));
-
-// oops, the year is missing!
-assert!(Utc.datetime_from_str("Fri Nov 28 12:00:09", "%a %b %e %T %Y").is_err());
-// oops, the format string does not include the year at all!
-assert!(Utc.datetime_from_str("Fri Nov 28 12:00:09", "%a %b %e %T").is_err());
-// oops, the weekday is incorrect!
-assert!(Utc.datetime_from_str("Sat Nov 28 12:00:09 2014", "%a %b %e %T %Y").is_err());
-

Again : See format::strftime -documentation for full syntax and list of specifiers.

-

Conversion from and to EPOCH timestamps

-

Use Utc.timestamp(seconds, nanoseconds) -to construct a DateTime<Utc> from a UNIX timestamp -(seconds, nanoseconds that passed since January 1st 1970).

-

Use DateTime.timestamp to get the timestamp (in seconds) -from a DateTime. Additionally, you can use -DateTime.timestamp_subsec_nanos -to get the number of additional number of nanoseconds.

- -
-// We need the trait in scope to use Utc::timestamp().
-use chrono::{DateTime, TimeZone, Utc};
-
-// Construct a datetime from epoch:
-let dt = Utc.timestamp(1_500_000_000, 0);
-assert_eq!(dt.to_rfc2822(), "Fri, 14 Jul 2017 02:40:00 +0000");
-
-// Get epoch value from a datetime:
-let dt = DateTime::parse_from_rfc2822("Fri, 14 Jul 2017 02:40:00 +0000").unwrap();
-assert_eq!(dt.timestamp(), 1_500_000_000);
-

Individual date

-

Chrono also provides an individual date type (Date). -It also has time zones attached, and have to be constructed via time zones. -Most operations available to DateTime are also available to Date whenever appropriate.

- -
-use chrono::prelude::*;
-use chrono::offset::LocalResult;
-
-assert_eq!(Utc::today(), Utc::now().date());
-assert_eq!(Local::today(), Local::now().date());
-
-assert_eq!(Utc.ymd(2014, 11, 28).weekday(), Weekday::Fri);
-assert_eq!(Utc.ymd_opt(2014, 11, 31), LocalResult::None);
-assert_eq!(Utc.ymd(2014, 11, 28).and_hms_milli(7, 8, 9, 10).format("%H%M%S").to_string(),
-           "070809");
-

There is no timezone-aware Time due to the lack of usefulness and also the complexity.

-

DateTime has date method -which returns a Date which represents its date component. -There is also a time method, -which simply returns a naive local time described below.

-

Naive date and time

-

Chrono provides naive counterparts to Date, (non-existent) Time and DateTime -as NaiveDate, -NaiveTime and -NaiveDateTime respectively.

-

They have almost equivalent interfaces as their timezone-aware twins, -but are not associated to time zones obviously and can be quite low-level. -They are mostly useful for building blocks for higher-level types.

-

Timezone-aware DateTime and Date types have two methods returning naive versions: -naive_local returns -a view to the naive local time, -and naive_utc returns -a view to the naive UTC time.

-

Limitations

-

Only proleptic Gregorian calendar (i.e. extended to support older dates) is supported. -Be very careful if you really have to deal with pre-20C dates, they can be in Julian or others.

-

Date types are limited in about +/- 262,000 years from the common epoch. -Time types are limited in the nanosecond accuracy.

-

Leap seconds are supported in the representation but -Chrono doesn't try to make use of them. -(The main reason is that leap seconds are not really predictable.) -Almost every operation over the possible leap seconds will ignore them. -Consider using NaiveDateTime with the implicit TAI (International Atomic Time) scale -if you want.

-

Chrono inherently does not support an inaccurate or partial date and time representation. -Any operation that can be ambiguous will return None in such cases. -For example, "a month later" of 2014-01-30 is not well-defined -and consequently Utc.ymd(2014, 1, 30).with_month(2) returns None.

-

Non ISO week handling is not yet supported. -For now you can use the chrono_ext -crate (sources).

-

Advanced time zone handling is not yet supported. -For now you can try the Chrono-tz crate instead.

-

Re-exports

-
pub use format::ParseError;
pub use format::ParseResult;
pub use naive::IsoWeek;
pub use naive::NaiveDate;
pub use naive::NaiveDateTime;
pub use naive::NaiveTime;
pub use offset::Local;
pub use offset::FixedOffset;
pub use offset::LocalResult;
pub use offset::Offset;
pub use offset::TimeZone;
pub use offset::Utc;

Modules

-
format

Formatting (and parsing) utilities for date and time.

-
naive

Date and time types unconcerned with timezones.

-
offset

The time zone, which calculates offsets from the local time to UTC.

-
prelude

A convenience module appropriate for glob imports (use chrono::prelude::*;).

-

Structs

-
Date

ISO 8601 calendar date with time zone.

-
DateTime

ISO 8601 combined date and time with time zone.

-
Duration

ISO 8601 time duration with nanosecond precision. -This also allows for the negative duration; see individual methods for details.

-
ParseMonthError

An error resulting from reading <Month> value with FromStr.

-
ParseWeekdayError

An error resulting from reading Weekday value with FromStr.

-

Enums

-
Month

The month of the year.

-
RoundingError

An error from rounding by Duration

-
SecondsFormat

Specific formatting options for seconds. This may be extended in the -future, so exhaustive matching in external code is not recommended.

-
Weekday

The day of week.

-

Constants

-
MAX_DATE

The maximum possible Date.

-
MAX_DATETIME

The maximum possible DateTime<Utc>.

-
MIN_DATE

The minimum possible Date.

-
MIN_DATETIME

The minimum possible DateTime<Utc>.

-

Traits

-
Datelike

The common set of methods for date component.

-
DurationRound

Extension trait for rounding or truncating a DateTime by a Duration.

-
SubsecRound

Extension trait for subsecond rounding or truncation to a maximum number -of digits. Rounding can be used to decrease the error variance when -serializing/persisting to lower precision. Truncation is the default -behavior in Chrono display formatting. Either can be used to guarantee -equality (e.g. for testing) when round-tripping through a lower precision -format.

-
Timelike

The common set of methods for time component.

-
\ No newline at end of file diff --git a/docs/chrono/naive/constant.MAX_DATE.html b/docs/chrono/naive/constant.MAX_DATE.html deleted file mode 100644 index ed9bd572..00000000 --- a/docs/chrono/naive/constant.MAX_DATE.html +++ /dev/null @@ -1,5 +0,0 @@ -chrono::naive::MAX_DATE - Rust - -

[][src]Constant chrono::naive::MAX_DATE

pub const MAX_DATE: NaiveDate;

The maximum possible NaiveDate (December 31, 262143 CE).

-
\ No newline at end of file diff --git a/docs/chrono/naive/constant.MAX_DATETIME.html b/docs/chrono/naive/constant.MAX_DATETIME.html deleted file mode 100644 index 1c9f7ffc..00000000 --- a/docs/chrono/naive/constant.MAX_DATETIME.html +++ /dev/null @@ -1,5 +0,0 @@ -chrono::naive::MAX_DATETIME - Rust - -

[][src]Constant chrono::naive::MAX_DATETIME

pub const MAX_DATETIME: NaiveDateTime;

The maximum possible NaiveDateTime.

-
\ No newline at end of file diff --git a/docs/chrono/naive/constant.MIN_DATE.html b/docs/chrono/naive/constant.MIN_DATE.html deleted file mode 100644 index 393167ef..00000000 --- a/docs/chrono/naive/constant.MIN_DATE.html +++ /dev/null @@ -1,5 +0,0 @@ -chrono::naive::MIN_DATE - Rust - -

[][src]Constant chrono::naive::MIN_DATE

pub const MIN_DATE: NaiveDate;

The minimum possible NaiveDate (January 1, 262145 BCE).

-
\ No newline at end of file diff --git a/docs/chrono/naive/constant.MIN_DATETIME.html b/docs/chrono/naive/constant.MIN_DATETIME.html deleted file mode 100644 index 01a9c4a9..00000000 --- a/docs/chrono/naive/constant.MIN_DATETIME.html +++ /dev/null @@ -1,5 +0,0 @@ -chrono::naive::MIN_DATETIME - Rust - -

[][src]Constant chrono::naive::MIN_DATETIME

pub const MIN_DATETIME: NaiveDateTime;

The minimum possible NaiveDateTime.

-
\ No newline at end of file diff --git a/docs/chrono/naive/date/constant.MAX_DATE.html b/docs/chrono/naive/date/constant.MAX_DATE.html deleted file mode 100644 index f9407257..00000000 --- a/docs/chrono/naive/date/constant.MAX_DATE.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -

Redirecting to ../../../chrono/naive/constant.MAX_DATE.html...

- - - \ No newline at end of file diff --git a/docs/chrono/naive/date/constant.MIN_DATE.html b/docs/chrono/naive/date/constant.MIN_DATE.html deleted file mode 100644 index f9fa9dcc..00000000 --- a/docs/chrono/naive/date/constant.MIN_DATE.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -

Redirecting to ../../../chrono/naive/constant.MIN_DATE.html...

- - - \ No newline at end of file diff --git a/docs/chrono/naive/date/struct.NaiveDate.html b/docs/chrono/naive/date/struct.NaiveDate.html deleted file mode 100644 index 2c1302a0..00000000 --- a/docs/chrono/naive/date/struct.NaiveDate.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -

Redirecting to ../../../chrono/naive/struct.NaiveDate.html...

- - - \ No newline at end of file diff --git a/docs/chrono/naive/datetime/constant.MAX_DATETIME.html b/docs/chrono/naive/datetime/constant.MAX_DATETIME.html deleted file mode 100644 index dc4e4111..00000000 --- a/docs/chrono/naive/datetime/constant.MAX_DATETIME.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -

Redirecting to ../../../chrono/naive/constant.MAX_DATETIME.html...

- - - \ No newline at end of file diff --git a/docs/chrono/naive/datetime/constant.MIN_DATETIME.html b/docs/chrono/naive/datetime/constant.MIN_DATETIME.html deleted file mode 100644 index e5ac290b..00000000 --- a/docs/chrono/naive/datetime/constant.MIN_DATETIME.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -

Redirecting to ../../../chrono/naive/constant.MIN_DATETIME.html...

- - - \ No newline at end of file diff --git a/docs/chrono/naive/datetime/struct.NaiveDateTime.html b/docs/chrono/naive/datetime/struct.NaiveDateTime.html deleted file mode 100644 index 8c2ea7d9..00000000 --- a/docs/chrono/naive/datetime/struct.NaiveDateTime.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -

Redirecting to ../../../chrono/naive/struct.NaiveDateTime.html...

- - - \ No newline at end of file diff --git a/docs/chrono/naive/index.html b/docs/chrono/naive/index.html deleted file mode 100644 index 32e02d11..00000000 --- a/docs/chrono/naive/index.html +++ /dev/null @@ -1,22 +0,0 @@ -chrono::naive - Rust - -

[][src]Module chrono::naive

Date and time types unconcerned with timezones.

-

They are primarily building blocks for other types -(e.g. TimeZone), -but can be also used for the simpler date and time handling.

-

Structs

-
IsoWeek

ISO 8601 week.

-
NaiveDate

ISO 8601 calendar date without timezone. -Allows for every proleptic Gregorian date -from Jan 1, 262145 BCE to Dec 31, 262143 CE. -Also supports the conversion from ISO 8601 ordinal and week date.

-
NaiveDateTime

ISO 8601 combined date and time without timezone.

-
NaiveTime

ISO 8601 time without timezone. -Allows for the nanosecond precision and optional leap second representation.

-

Constants

-
MAX_DATE

The maximum possible NaiveDate (December 31, 262143 CE).

-
MAX_DATETIME

The maximum possible NaiveDateTime.

-
MIN_DATE

The minimum possible NaiveDate (January 1, 262145 BCE).

-
MIN_DATETIME

The minimum possible NaiveDateTime.

-
\ No newline at end of file diff --git a/docs/chrono/naive/isoweek/struct.IsoWeek.html b/docs/chrono/naive/isoweek/struct.IsoWeek.html deleted file mode 100644 index 60ca65f7..00000000 --- a/docs/chrono/naive/isoweek/struct.IsoWeek.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -

Redirecting to ../../../chrono/naive/struct.IsoWeek.html...

- - - \ No newline at end of file diff --git a/docs/chrono/naive/sidebar-items.js b/docs/chrono/naive/sidebar-items.js deleted file mode 100644 index 392733eb..00000000 --- a/docs/chrono/naive/sidebar-items.js +++ /dev/null @@ -1 +0,0 @@ -initSidebarItems({"constant":[["MAX_DATE","The maximum possible `NaiveDate` (December 31, 262143 CE)."],["MAX_DATETIME","The maximum possible `NaiveDateTime`."],["MIN_DATE","The minimum possible `NaiveDate` (January 1, 262145 BCE)."],["MIN_DATETIME","The minimum possible `NaiveDateTime`."]],"struct":[["IsoWeek","ISO 8601 week."],["NaiveDate","ISO 8601 calendar date without timezone. Allows for every proleptic Gregorian date from Jan 1, 262145 BCE to Dec 31, 262143 CE. Also supports the conversion from ISO 8601 ordinal and week date."],["NaiveDateTime","ISO 8601 combined date and time without timezone."],["NaiveTime","ISO 8601 time without timezone. Allows for the nanosecond precision and optional leap second representation."]]}); \ No newline at end of file diff --git a/docs/chrono/naive/struct.IsoWeek.html b/docs/chrono/naive/struct.IsoWeek.html deleted file mode 100644 index e9487178..00000000 --- a/docs/chrono/naive/struct.IsoWeek.html +++ /dev/null @@ -1,83 +0,0 @@ -chrono::naive::IsoWeek - Rust - -

[][src]Struct chrono::naive::IsoWeek

pub struct IsoWeek { /* fields omitted */ }

ISO 8601 week.

-

This type, combined with Weekday, -constitues the ISO 8601 week date. -One can retrieve this type from the existing Datelike types -via the Datelike::iso_week method.

-

Implementations

impl IsoWeek[src]

pub fn year(&self) -> i32[src]

Returns the year number for this ISO week.

-

Example

-
-use chrono::{NaiveDate, Datelike, Weekday};
-
-let d = NaiveDate::from_isoywd(2015, 1, Weekday::Mon);
-assert_eq!(d.iso_week().year(), 2015);
-

This year number might not match the calendar year number. -Continuing the example...

- -
-assert_eq!(d.year(), 2014);
-assert_eq!(d, NaiveDate::from_ymd(2014, 12, 29));
-

pub fn week(&self) -> u32[src]

Returns the ISO week number starting from 1.

-

The return value ranges from 1 to 53. (The last week of year differs by years.)

-

Example

-
-use chrono::{NaiveDate, Datelike, Weekday};
-
-let d = NaiveDate::from_isoywd(2015, 15, Weekday::Mon);
-assert_eq!(d.iso_week().week(), 15);
-

pub fn week0(&self) -> u32[src]

Returns the ISO week number starting from 0.

-

The return value ranges from 0 to 52. (The last week of year differs by years.)

-

Example

-
-use chrono::{NaiveDate, Datelike, Weekday};
-
-let d = NaiveDate::from_isoywd(2015, 15, Weekday::Mon);
-assert_eq!(d.iso_week().week0(), 14);
-

Trait Implementations

impl Clone for IsoWeek[src]

impl Copy for IsoWeek[src]

impl Debug for IsoWeek[src]

The Debug output of the ISO week w is the same as -d.format("%G-W%V") -where d is any NaiveDate value in that week.

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(format!("{:?}", NaiveDate::from_ymd(2015,  9,  5).iso_week()), "2015-W36");
-assert_eq!(format!("{:?}", NaiveDate::from_ymd(   0,  1,  3).iso_week()), "0000-W01");
-assert_eq!(format!("{:?}", NaiveDate::from_ymd(9999, 12, 31).iso_week()), "9999-W52");
-

ISO 8601 requires an explicit sign for years before 1 BCE or after 9999 CE.

- -
-assert_eq!(format!("{:?}", NaiveDate::from_ymd(    0,  1,  2).iso_week()),  "-0001-W52");
-assert_eq!(format!("{:?}", NaiveDate::from_ymd(10000, 12, 31).iso_week()), "+10000-W52");
-

impl Eq for IsoWeek[src]

impl Ord for IsoWeek[src]

impl PartialEq<IsoWeek> for IsoWeek[src]

impl PartialOrd<IsoWeek> for IsoWeek[src]

impl StructuralEq for IsoWeek[src]

impl StructuralPartialEq for IsoWeek[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

-

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-
\ No newline at end of file diff --git a/docs/chrono/naive/struct.NaiveDate.html b/docs/chrono/naive/struct.NaiveDate.html deleted file mode 100644 index bc7a9051..00000000 --- a/docs/chrono/naive/struct.NaiveDate.html +++ /dev/null @@ -1,899 +0,0 @@ -chrono::naive::NaiveDate - Rust - -

[][src]Struct chrono::naive::NaiveDate

pub struct NaiveDate { /* fields omitted */ }

ISO 8601 calendar date without timezone. -Allows for every proleptic Gregorian date -from Jan 1, 262145 BCE to Dec 31, 262143 CE. -Also supports the conversion from ISO 8601 ordinal and week date.

-

Calendar Date

-

The ISO 8601 calendar date follows the proleptic Gregorian calendar. -It is like a normal civil calendar but note some slight differences:

-
    -
  • -

    Dates before the Gregorian calendar's inception in 1582 are defined via the extrapolation. -Be careful, as historical dates are often noted in the Julian calendar and others -and the transition to Gregorian may differ across countries (as late as early 20C).

    -

    (Some example: Both Shakespeare from Britain and Cervantes from Spain seemingly died -on the same calendar date---April 23, 1616---but in the different calendar. -Britain used the Julian calendar at that time, so Shakespeare's death is later.)

    -
  • -
  • -

    ISO 8601 calendars has the year 0, which is 1 BCE (a year before 1 CE). -If you need a typical BCE/BC and CE/AD notation for year numbers, -use the Datelike::year_ce method.

    -
  • -
-

Week Date

-

The ISO 8601 week date is a triple of year number, week number -and day of the week with the following rules:

-
    -
  • -

    A week consists of Monday through Sunday, and is always numbered within some year. -The week number ranges from 1 to 52 or 53 depending on the year.

    -
  • -
  • -

    The week 1 of given year is defined as the first week containing January 4 of that year, -or equivalently, the first week containing four or more days in that year.

    -
  • -
  • -

    The year number in the week date may not correspond to the actual Gregorian year. -For example, January 3, 2016 (Sunday) was on the last (53rd) week of 2015.

    -
  • -
-

Chrono's date types default to the ISO 8601 calendar date, -but Datelike::iso_week and -Datelike::weekday methods -can be used to get the corresponding week date.

-

Ordinal Date

-

The ISO 8601 ordinal date is a pair of year number and day of the year ("ordinal"). -The ordinal number ranges from 1 to 365 or 366 depending on the year. -The year number is the same as that of the calendar date.

-

This is currently the internal format of Chrono's date types.

-

Implementations

impl NaiveDate[src]

pub fn from_ymd(year: i32, month: u32, day: u32) -> NaiveDate[src]

Makes a new NaiveDate from the calendar date -(year, month and day).

-

Panics on the out-of-range date, invalid month and/or day.

-

Example

-
-use chrono::{NaiveDate, Datelike, Weekday};
-
-let d = NaiveDate::from_ymd(2015, 3, 14);
-assert_eq!(d.year(), 2015);
-assert_eq!(d.month(), 3);
-assert_eq!(d.day(), 14);
-assert_eq!(d.ordinal(), 73); // day of year
-assert_eq!(d.iso_week().year(), 2015);
-assert_eq!(d.iso_week().week(), 11);
-assert_eq!(d.weekday(), Weekday::Sat);
-assert_eq!(d.num_days_from_ce(), 735671); // days since January 1, 1 CE
-

pub fn from_ymd_opt(year: i32, month: u32, day: u32) -> Option<NaiveDate>[src]

Makes a new NaiveDate from the calendar date -(year, month and day).

-

Returns None on the out-of-range date, invalid month and/or day.

-

Example

-
-use chrono::NaiveDate;
-
-let from_ymd_opt = NaiveDate::from_ymd_opt;
-
-assert!(from_ymd_opt(2015, 3, 14).is_some());
-assert!(from_ymd_opt(2015, 0, 14).is_none());
-assert!(from_ymd_opt(2015, 2, 29).is_none());
-assert!(from_ymd_opt(-4, 2, 29).is_some()); // 5 BCE is a leap year
-assert!(from_ymd_opt(400000, 1, 1).is_none());
-assert!(from_ymd_opt(-400000, 1, 1).is_none());
-

pub fn from_yo(year: i32, ordinal: u32) -> NaiveDate[src]

Makes a new NaiveDate from the ordinal date -(year and day of the year).

-

Panics on the out-of-range date and/or invalid day of year.

-

Example

-
-use chrono::{NaiveDate, Datelike, Weekday};
-
-let d = NaiveDate::from_yo(2015, 73);
-assert_eq!(d.ordinal(), 73);
-assert_eq!(d.year(), 2015);
-assert_eq!(d.month(), 3);
-assert_eq!(d.day(), 14);
-assert_eq!(d.iso_week().year(), 2015);
-assert_eq!(d.iso_week().week(), 11);
-assert_eq!(d.weekday(), Weekday::Sat);
-assert_eq!(d.num_days_from_ce(), 735671); // days since January 1, 1 CE
-

pub fn from_yo_opt(year: i32, ordinal: u32) -> Option<NaiveDate>[src]

Makes a new NaiveDate from the ordinal date -(year and day of the year).

-

Returns None on the out-of-range date and/or invalid day of year.

-

Example

-
-use chrono::NaiveDate;
-
-let from_yo_opt = NaiveDate::from_yo_opt;
-
-assert!(from_yo_opt(2015, 100).is_some());
-assert!(from_yo_opt(2015, 0).is_none());
-assert!(from_yo_opt(2015, 365).is_some());
-assert!(from_yo_opt(2015, 366).is_none());
-assert!(from_yo_opt(-4, 366).is_some()); // 5 BCE is a leap year
-assert!(from_yo_opt(400000, 1).is_none());
-assert!(from_yo_opt(-400000, 1).is_none());
-

pub fn from_isoywd(year: i32, week: u32, weekday: Weekday) -> NaiveDate[src]

Makes a new NaiveDate from the ISO week date -(year, week number and day of the week). -The resulting NaiveDate may have a different year from the input year.

-

Panics on the out-of-range date and/or invalid week number.

-

Example

-
-use chrono::{NaiveDate, Datelike, Weekday};
-
-let d = NaiveDate::from_isoywd(2015, 11, Weekday::Sat);
-assert_eq!(d.iso_week().year(), 2015);
-assert_eq!(d.iso_week().week(), 11);
-assert_eq!(d.weekday(), Weekday::Sat);
-assert_eq!(d.year(), 2015);
-assert_eq!(d.month(), 3);
-assert_eq!(d.day(), 14);
-assert_eq!(d.ordinal(), 73); // day of year
-assert_eq!(d.num_days_from_ce(), 735671); // days since January 1, 1 CE
-

pub fn from_isoywd_opt(
    year: i32,
    week: u32,
    weekday: Weekday
) -> Option<NaiveDate>
[src]

Makes a new NaiveDate from the ISO week date -(year, week number and day of the week). -The resulting NaiveDate may have a different year from the input year.

-

Returns None on the out-of-range date and/or invalid week number.

-

Example

-
-use chrono::{NaiveDate, Weekday};
-
-let from_ymd = NaiveDate::from_ymd;
-let from_isoywd_opt = NaiveDate::from_isoywd_opt;
-
-assert_eq!(from_isoywd_opt(2015, 0, Weekday::Sun), None);
-assert_eq!(from_isoywd_opt(2015, 10, Weekday::Sun), Some(from_ymd(2015, 3, 8)));
-assert_eq!(from_isoywd_opt(2015, 30, Weekday::Mon), Some(from_ymd(2015, 7, 20)));
-assert_eq!(from_isoywd_opt(2015, 60, Weekday::Mon), None);
-
-assert_eq!(from_isoywd_opt(400000, 10, Weekday::Fri), None);
-assert_eq!(from_isoywd_opt(-400000, 10, Weekday::Sat), None);
-

The year number of ISO week date may differ from that of the calendar date.

- -
-//           Mo Tu We Th Fr Sa Su
-// 2014-W52  22 23 24 25 26 27 28    has 4+ days of new year,
-// 2015-W01  29 30 31  1  2  3  4 <- so this is the first week
-assert_eq!(from_isoywd_opt(2014, 52, Weekday::Sun), Some(from_ymd(2014, 12, 28)));
-assert_eq!(from_isoywd_opt(2014, 53, Weekday::Mon), None);
-assert_eq!(from_isoywd_opt(2015, 1, Weekday::Mon), Some(from_ymd(2014, 12, 29)));
-
-// 2015-W52  21 22 23 24 25 26 27    has 4+ days of old year,
-// 2015-W53  28 29 30 31  1  2  3 <- so this is the last week
-// 2016-W01   4  5  6  7  8  9 10
-assert_eq!(from_isoywd_opt(2015, 52, Weekday::Sun), Some(from_ymd(2015, 12, 27)));
-assert_eq!(from_isoywd_opt(2015, 53, Weekday::Sun), Some(from_ymd(2016, 1, 3)));
-assert_eq!(from_isoywd_opt(2015, 54, Weekday::Mon), None);
-assert_eq!(from_isoywd_opt(2016, 1, Weekday::Mon), Some(from_ymd(2016, 1, 4)));
-

pub fn from_num_days_from_ce(days: i32) -> NaiveDate[src]

Makes a new NaiveDate from a day's number in the proleptic Gregorian calendar, with -January 1, 1 being day 1.

-

Panics if the date is out of range.

-

Example

-
-use chrono::{NaiveDate, Datelike, Weekday};
-
-let d = NaiveDate::from_num_days_from_ce(735671);
-assert_eq!(d.num_days_from_ce(), 735671); // days since January 1, 1 CE
-assert_eq!(d.year(), 2015);
-assert_eq!(d.month(), 3);
-assert_eq!(d.day(), 14);
-assert_eq!(d.ordinal(), 73); // day of year
-assert_eq!(d.iso_week().year(), 2015);
-assert_eq!(d.iso_week().week(), 11);
-assert_eq!(d.weekday(), Weekday::Sat);
-

While not directly supported by Chrono, -it is easy to convert from the Julian day number -(January 1, 4713 BCE in the Julian calendar being Day 0) -to Gregorian with this method. -(Note that this panics when jd is out of range.)

- -
-use chrono::NaiveDate;
-
-fn jd_to_date(jd: i32) -> NaiveDate {
-    // keep in mind that the Julian day number is 0-based
-    // while this method requires an 1-based number.
-    NaiveDate::from_num_days_from_ce(jd - 1721425)
-}
-
-// January 1, 4713 BCE in Julian = November 24, 4714 BCE in Gregorian
-assert_eq!(jd_to_date(0), NaiveDate::from_ymd(-4713, 11, 24));
-
-assert_eq!(jd_to_date(1721426), NaiveDate::from_ymd(1, 1, 1));
-assert_eq!(jd_to_date(2450000), NaiveDate::from_ymd(1995, 10, 9));
-assert_eq!(jd_to_date(2451545), NaiveDate::from_ymd(2000, 1, 1));
-

pub fn from_num_days_from_ce_opt(days: i32) -> Option<NaiveDate>[src]

Makes a new NaiveDate from a day's number in the proleptic Gregorian calendar, with -January 1, 1 being day 1.

-

Returns None if the date is out of range.

-

Example

-
-use chrono::NaiveDate;
-
-let from_ndays_opt = NaiveDate::from_num_days_from_ce_opt;
-let from_ymd = NaiveDate::from_ymd;
-
-assert_eq!(from_ndays_opt(730_000),      Some(from_ymd(1999, 9, 3)));
-assert_eq!(from_ndays_opt(1),            Some(from_ymd(1, 1, 1)));
-assert_eq!(from_ndays_opt(0),            Some(from_ymd(0, 12, 31)));
-assert_eq!(from_ndays_opt(-1),           Some(from_ymd(0, 12, 30)));
-assert_eq!(from_ndays_opt(100_000_000),  None);
-assert_eq!(from_ndays_opt(-100_000_000), None);
-

pub fn from_weekday_of_month(
    year: i32,
    month: u32,
    weekday: Weekday,
    n: u8
) -> NaiveDate
[src]

Makes a new NaiveDate by counting the number of occurrences of a particular day-of-week -since the beginning of the given month. For instance, if you want the 2nd Friday of March -2017, you would use NaiveDate::from_weekday_of_month(2017, 3, Weekday::Fri, 2).

-

Panics

-

The resulting NaiveDate is guaranteed to be in month. If n is larger than the number -of weekday in month (eg. the 6th Friday of March 2017) then this function will panic.

-

n is 1-indexed. Passing n=0 will cause a panic.

-

Example

-
-use chrono::{NaiveDate, Weekday};
-
-let from_weekday_of_month = NaiveDate::from_weekday_of_month;
-let from_ymd = NaiveDate::from_ymd;
-
-assert_eq!(from_weekday_of_month(2018, 8, Weekday::Wed, 1), from_ymd(2018, 8, 1));
-assert_eq!(from_weekday_of_month(2018, 8, Weekday::Fri, 1), from_ymd(2018, 8, 3));
-assert_eq!(from_weekday_of_month(2018, 8, Weekday::Tue, 2), from_ymd(2018, 8, 14));
-assert_eq!(from_weekday_of_month(2018, 8, Weekday::Fri, 4), from_ymd(2018, 8, 24));
-assert_eq!(from_weekday_of_month(2018, 8, Weekday::Fri, 5), from_ymd(2018, 8, 31));
-

pub fn from_weekday_of_month_opt(
    year: i32,
    month: u32,
    weekday: Weekday,
    n: u8
) -> Option<NaiveDate>
[src]

Makes a new NaiveDate by counting the number of occurrences of a particular day-of-week -since the beginning of the given month. For instance, if you want the 2nd Friday of March -2017, you would use NaiveDate::from_weekday_of_month(2017, 3, Weekday::Fri, 2). n is 1-indexed.

- -
-use chrono::{NaiveDate, Weekday};
-assert_eq!(NaiveDate::from_weekday_of_month_opt(2017, 3, Weekday::Fri, 2),
-           NaiveDate::from_ymd_opt(2017, 3, 10))
-

Returns None if n out-of-range; ie. if n is larger than the number of weekday in -month (eg. the 6th Friday of March 2017), or if n == 0.

-

pub fn parse_from_str(s: &str, fmt: &str) -> ParseResult<NaiveDate>[src]

Parses a string with the specified format string and returns a new NaiveDate. -See the format::strftime module -on the supported escape sequences.

-

Example

-
-use chrono::NaiveDate;
-
-let parse_from_str = NaiveDate::parse_from_str;
-
-assert_eq!(parse_from_str("2015-09-05", "%Y-%m-%d"),
-           Ok(NaiveDate::from_ymd(2015, 9, 5)));
-assert_eq!(parse_from_str("5sep2015", "%d%b%Y"),
-           Ok(NaiveDate::from_ymd(2015, 9, 5)));
-

Time and offset is ignored for the purpose of parsing.

- -
-assert_eq!(parse_from_str("2014-5-17T12:34:56+09:30", "%Y-%m-%dT%H:%M:%S%z"),
-           Ok(NaiveDate::from_ymd(2014, 5, 17)));
-

Out-of-bound dates or insufficient fields are errors.

- -
-assert!(parse_from_str("2015/9", "%Y/%m").is_err());
-assert!(parse_from_str("2015/9/31", "%Y/%m/%d").is_err());
-

All parsed fields should be consistent to each other, otherwise it's an error.

- -
-assert!(parse_from_str("Sat, 09 Aug 2013", "%a, %d %b %Y").is_err());
-

pub fn and_time(&self, time: NaiveTime) -> NaiveDateTime[src]

Makes a new NaiveDateTime from the current date and given NaiveTime.

-

Example

-
-use chrono::{NaiveDate, NaiveTime, NaiveDateTime};
-
-let d = NaiveDate::from_ymd(2015, 6, 3);
-let t = NaiveTime::from_hms_milli(12, 34, 56, 789);
-
-let dt: NaiveDateTime = d.and_time(t);
-assert_eq!(dt.date(), d);
-assert_eq!(dt.time(), t);
-

pub fn and_hms(&self, hour: u32, min: u32, sec: u32) -> NaiveDateTime[src]

Makes a new NaiveDateTime from the current date, hour, minute and second.

-

No leap second is allowed here; -use NaiveDate::and_hms_* methods with a subsecond parameter instead.

-

Panics on invalid hour, minute and/or second.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike, Timelike, Weekday};
-
-let d = NaiveDate::from_ymd(2015, 6, 3);
-
-let dt: NaiveDateTime = d.and_hms(12, 34, 56);
-assert_eq!(dt.year(), 2015);
-assert_eq!(dt.weekday(), Weekday::Wed);
-assert_eq!(dt.second(), 56);
-

pub fn and_hms_opt(
    &self,
    hour: u32,
    min: u32,
    sec: u32
) -> Option<NaiveDateTime>
[src]

Makes a new NaiveDateTime from the current date, hour, minute and second.

-

No leap second is allowed here; -use NaiveDate::and_hms_*_opt methods with a subsecond parameter instead.

-

Returns None on invalid hour, minute and/or second.

-

Example

-
-use chrono::NaiveDate;
-
-let d = NaiveDate::from_ymd(2015, 6, 3);
-assert!(d.and_hms_opt(12, 34, 56).is_some());
-assert!(d.and_hms_opt(12, 34, 60).is_none()); // use `and_hms_milli_opt` instead
-assert!(d.and_hms_opt(12, 60, 56).is_none());
-assert!(d.and_hms_opt(24, 34, 56).is_none());
-

pub fn and_hms_milli(
    &self,
    hour: u32,
    min: u32,
    sec: u32,
    milli: u32
) -> NaiveDateTime
[src]

Makes a new NaiveDateTime from the current date, hour, minute, second and millisecond.

-

The millisecond part can exceed 1,000 -in order to represent the leap second.

-

Panics on invalid hour, minute, second and/or millisecond.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike, Timelike, Weekday};
-
-let d = NaiveDate::from_ymd(2015, 6, 3);
-
-let dt: NaiveDateTime = d.and_hms_milli(12, 34, 56, 789);
-assert_eq!(dt.year(), 2015);
-assert_eq!(dt.weekday(), Weekday::Wed);
-assert_eq!(dt.second(), 56);
-assert_eq!(dt.nanosecond(), 789_000_000);
-

pub fn and_hms_milli_opt(
    &self,
    hour: u32,
    min: u32,
    sec: u32,
    milli: u32
) -> Option<NaiveDateTime>
[src]

Makes a new NaiveDateTime from the current date, hour, minute, second and millisecond.

-

The millisecond part can exceed 1,000 -in order to represent the leap second.

-

Returns None on invalid hour, minute, second and/or millisecond.

-

Example

-
-use chrono::NaiveDate;
-
-let d = NaiveDate::from_ymd(2015, 6, 3);
-assert!(d.and_hms_milli_opt(12, 34, 56,   789).is_some());
-assert!(d.and_hms_milli_opt(12, 34, 59, 1_789).is_some()); // leap second
-assert!(d.and_hms_milli_opt(12, 34, 59, 2_789).is_none());
-assert!(d.and_hms_milli_opt(12, 34, 60,   789).is_none());
-assert!(d.and_hms_milli_opt(12, 60, 56,   789).is_none());
-assert!(d.and_hms_milli_opt(24, 34, 56,   789).is_none());
-

pub fn and_hms_micro(
    &self,
    hour: u32,
    min: u32,
    sec: u32,
    micro: u32
) -> NaiveDateTime
[src]

Makes a new NaiveDateTime from the current date, hour, minute, second and microsecond.

-

The microsecond part can exceed 1,000,000 -in order to represent the leap second.

-

Panics on invalid hour, minute, second and/or microsecond.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike, Timelike, Weekday};
-
-let d = NaiveDate::from_ymd(2015, 6, 3);
-
-let dt: NaiveDateTime = d.and_hms_micro(12, 34, 56, 789_012);
-assert_eq!(dt.year(), 2015);
-assert_eq!(dt.weekday(), Weekday::Wed);
-assert_eq!(dt.second(), 56);
-assert_eq!(dt.nanosecond(), 789_012_000);
-

pub fn and_hms_micro_opt(
    &self,
    hour: u32,
    min: u32,
    sec: u32,
    micro: u32
) -> Option<NaiveDateTime>
[src]

Makes a new NaiveDateTime from the current date, hour, minute, second and microsecond.

-

The microsecond part can exceed 1,000,000 -in order to represent the leap second.

-

Returns None on invalid hour, minute, second and/or microsecond.

-

Example

-
-use chrono::NaiveDate;
-
-let d = NaiveDate::from_ymd(2015, 6, 3);
-assert!(d.and_hms_micro_opt(12, 34, 56,   789_012).is_some());
-assert!(d.and_hms_micro_opt(12, 34, 59, 1_789_012).is_some()); // leap second
-assert!(d.and_hms_micro_opt(12, 34, 59, 2_789_012).is_none());
-assert!(d.and_hms_micro_opt(12, 34, 60,   789_012).is_none());
-assert!(d.and_hms_micro_opt(12, 60, 56,   789_012).is_none());
-assert!(d.and_hms_micro_opt(24, 34, 56,   789_012).is_none());
-

pub fn and_hms_nano(
    &self,
    hour: u32,
    min: u32,
    sec: u32,
    nano: u32
) -> NaiveDateTime
[src]

Makes a new NaiveDateTime from the current date, hour, minute, second and nanosecond.

-

The nanosecond part can exceed 1,000,000,000 -in order to represent the leap second.

-

Panics on invalid hour, minute, second and/or nanosecond.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike, Timelike, Weekday};
-
-let d = NaiveDate::from_ymd(2015, 6, 3);
-
-let dt: NaiveDateTime = d.and_hms_nano(12, 34, 56, 789_012_345);
-assert_eq!(dt.year(), 2015);
-assert_eq!(dt.weekday(), Weekday::Wed);
-assert_eq!(dt.second(), 56);
-assert_eq!(dt.nanosecond(), 789_012_345);
-

pub fn and_hms_nano_opt(
    &self,
    hour: u32,
    min: u32,
    sec: u32,
    nano: u32
) -> Option<NaiveDateTime>
[src]

Makes a new NaiveDateTime from the current date, hour, minute, second and nanosecond.

-

The nanosecond part can exceed 1,000,000,000 -in order to represent the leap second.

-

Returns None on invalid hour, minute, second and/or nanosecond.

-

Example

-
-use chrono::NaiveDate;
-
-let d = NaiveDate::from_ymd(2015, 6, 3);
-assert!(d.and_hms_nano_opt(12, 34, 56,   789_012_345).is_some());
-assert!(d.and_hms_nano_opt(12, 34, 59, 1_789_012_345).is_some()); // leap second
-assert!(d.and_hms_nano_opt(12, 34, 59, 2_789_012_345).is_none());
-assert!(d.and_hms_nano_opt(12, 34, 60,   789_012_345).is_none());
-assert!(d.and_hms_nano_opt(12, 60, 56,   789_012_345).is_none());
-assert!(d.and_hms_nano_opt(24, 34, 56,   789_012_345).is_none());
-

pub fn succ(&self) -> NaiveDate[src]

Makes a new NaiveDate for the next calendar date.

-

Panics when self is the last representable date.

-

Example

-
-use chrono::NaiveDate;
-
-assert_eq!(NaiveDate::from_ymd(2015,  6,  3).succ(), NaiveDate::from_ymd(2015, 6, 4));
-assert_eq!(NaiveDate::from_ymd(2015,  6, 30).succ(), NaiveDate::from_ymd(2015, 7, 1));
-assert_eq!(NaiveDate::from_ymd(2015, 12, 31).succ(), NaiveDate::from_ymd(2016, 1, 1));
-

pub fn succ_opt(&self) -> Option<NaiveDate>[src]

Makes a new NaiveDate for the next calendar date.

-

Returns None when self is the last representable date.

-

Example

-
-use chrono::NaiveDate;
-use chrono::naive::MAX_DATE;
-
-assert_eq!(NaiveDate::from_ymd(2015, 6, 3).succ_opt(),
-           Some(NaiveDate::from_ymd(2015, 6, 4)));
-assert_eq!(MAX_DATE.succ_opt(), None);
-

pub fn pred(&self) -> NaiveDate[src]

Makes a new NaiveDate for the previous calendar date.

-

Panics when self is the first representable date.

-

Example

-
-use chrono::NaiveDate;
-
-assert_eq!(NaiveDate::from_ymd(2015, 6, 3).pred(), NaiveDate::from_ymd(2015,  6,  2));
-assert_eq!(NaiveDate::from_ymd(2015, 6, 1).pred(), NaiveDate::from_ymd(2015,  5, 31));
-assert_eq!(NaiveDate::from_ymd(2015, 1, 1).pred(), NaiveDate::from_ymd(2014, 12, 31));
-

pub fn pred_opt(&self) -> Option<NaiveDate>[src]

Makes a new NaiveDate for the previous calendar date.

-

Returns None when self is the first representable date.

-

Example

-
-use chrono::NaiveDate;
-use chrono::naive::MIN_DATE;
-
-assert_eq!(NaiveDate::from_ymd(2015, 6, 3).pred_opt(),
-           Some(NaiveDate::from_ymd(2015, 6, 2)));
-assert_eq!(MIN_DATE.pred_opt(), None);
-

pub fn checked_add_signed(self, rhs: OldDuration) -> Option<NaiveDate>[src]

Adds the days part of given Duration to the current date.

-

Returns None when it will result in overflow.

-

Example

-
-use chrono::{Duration, NaiveDate};
-use chrono::naive::MAX_DATE;
-
-let d = NaiveDate::from_ymd(2015, 9, 5);
-assert_eq!(d.checked_add_signed(Duration::days(40)),
-           Some(NaiveDate::from_ymd(2015, 10, 15)));
-assert_eq!(d.checked_add_signed(Duration::days(-40)),
-           Some(NaiveDate::from_ymd(2015, 7, 27)));
-assert_eq!(d.checked_add_signed(Duration::days(1_000_000_000)), None);
-assert_eq!(d.checked_add_signed(Duration::days(-1_000_000_000)), None);
-assert_eq!(MAX_DATE.checked_add_signed(Duration::days(1)), None);
-

pub fn checked_sub_signed(self, rhs: OldDuration) -> Option<NaiveDate>[src]

Subtracts the days part of given Duration from the current date.

-

Returns None when it will result in overflow.

-

Example

-
-use chrono::{Duration, NaiveDate};
-use chrono::naive::MIN_DATE;
-
-let d = NaiveDate::from_ymd(2015, 9, 5);
-assert_eq!(d.checked_sub_signed(Duration::days(40)),
-           Some(NaiveDate::from_ymd(2015, 7, 27)));
-assert_eq!(d.checked_sub_signed(Duration::days(-40)),
-           Some(NaiveDate::from_ymd(2015, 10, 15)));
-assert_eq!(d.checked_sub_signed(Duration::days(1_000_000_000)), None);
-assert_eq!(d.checked_sub_signed(Duration::days(-1_000_000_000)), None);
-assert_eq!(MIN_DATE.checked_sub_signed(Duration::days(1)), None);
-

pub fn signed_duration_since(self, rhs: NaiveDate) -> OldDuration[src]

Subtracts another NaiveDate from the current date. -Returns a Duration of integral numbers.

-

This does not overflow or underflow at all, -as all possible output fits in the range of Duration.

-

Example

-
-use chrono::{Duration, NaiveDate};
-
-let from_ymd = NaiveDate::from_ymd;
-let since = NaiveDate::signed_duration_since;
-
-assert_eq!(since(from_ymd(2014, 1, 1), from_ymd(2014, 1, 1)), Duration::zero());
-assert_eq!(since(from_ymd(2014, 1, 1), from_ymd(2013, 12, 31)), Duration::days(1));
-assert_eq!(since(from_ymd(2014, 1, 1), from_ymd(2014, 1, 2)), Duration::days(-1));
-assert_eq!(since(from_ymd(2014, 1, 1), from_ymd(2013, 9, 23)), Duration::days(100));
-assert_eq!(since(from_ymd(2014, 1, 1), from_ymd(2013, 1, 1)), Duration::days(365));
-assert_eq!(since(from_ymd(2014, 1, 1), from_ymd(2010, 1, 1)), Duration::days(365*4 + 1));
-assert_eq!(since(from_ymd(2014, 1, 1), from_ymd(1614, 1, 1)), Duration::days(365*400 + 97));
-

pub fn format_with_items<'a, I, B>(&self, items: I) -> DelayedFormat<I> where
    I: Iterator<Item = B> + Clone,
    B: Borrow<Item<'a>>, 
[src]

Formats the date with the specified formatting items. -Otherwise it is the same as the ordinary format method.

-

The Iterator of items should be Cloneable, -since the resulting DelayedFormat value may be formatted multiple times.

-

Example

-
-use chrono::NaiveDate;
-use chrono::format::strftime::StrftimeItems;
-
-let fmt = StrftimeItems::new("%Y-%m-%d");
-let d = NaiveDate::from_ymd(2015, 9, 5);
-assert_eq!(d.format_with_items(fmt.clone()).to_string(), "2015-09-05");
-assert_eq!(d.format("%Y-%m-%d").to_string(),             "2015-09-05");
-

The resulting DelayedFormat can be formatted directly via the Display trait.

- -
-assert_eq!(format!("{}", d.format_with_items(fmt)), "2015-09-05");
-

pub fn format<'a>(&self, fmt: &'a str) -> DelayedFormat<StrftimeItems<'a>>[src]

Formats the date with the specified format string. -See the format::strftime module -on the supported escape sequences.

-

This returns a DelayedFormat, -which gets converted to a string only when actual formatting happens. -You may use the to_string method to get a String, -or just feed it into print! and other formatting macros. -(In this way it avoids the redundant memory allocation.)

-

A wrong format string does not issue an error immediately. -Rather, converting or formatting the DelayedFormat fails. -You are recommended to immediately use DelayedFormat for this reason.

-

Example

-
-use chrono::NaiveDate;
-
-let d = NaiveDate::from_ymd(2015, 9, 5);
-assert_eq!(d.format("%Y-%m-%d").to_string(), "2015-09-05");
-assert_eq!(d.format("%A, %-d %B, %C%y").to_string(), "Saturday, 5 September, 2015");
-

The resulting DelayedFormat can be formatted directly via the Display trait.

- -
-assert_eq!(format!("{}", d.format("%Y-%m-%d")), "2015-09-05");
-assert_eq!(format!("{}", d.format("%A, %-d %B, %C%y")), "Saturday, 5 September, 2015");
-

pub fn iter_days(&self) -> NaiveDateDaysIterator[src]

Returns an iterator that steps by days until the last representable date.

-

Example

-
-
-let expected = [
-    NaiveDate::from_ymd(2016, 2, 27),
-    NaiveDate::from_ymd(2016, 2, 28),
-    NaiveDate::from_ymd(2016, 2, 29),
-    NaiveDate::from_ymd(2016, 3, 1),
-];
-
-let mut count = 0;
-for (idx, d) in NaiveDate::from_ymd(2016, 2, 27).iter_days().take(4).enumerate() {
-   assert_eq!(d, expected[idx]);
-   count += 1;
-}
-assert_eq!(count, 4);
-

pub fn iter_weeks(&self) -> NaiveDateWeeksIterator[src]

Returns an iterator that steps by weeks until the last representable date.

-

Example

-
-
-let expected = [
-    NaiveDate::from_ymd(2016, 2, 27),
-    NaiveDate::from_ymd(2016, 3, 5),
-    NaiveDate::from_ymd(2016, 3, 12),
-    NaiveDate::from_ymd(2016, 3, 19),
-];
-
-let mut count = 0;
-for (idx, d) in NaiveDate::from_ymd(2016, 2, 27).iter_weeks().take(4).enumerate() {
-   assert_eq!(d, expected[idx]);
-   count += 1;
-}
-assert_eq!(count, 4);
-

Trait Implementations

impl Add<Duration> for NaiveDate[src]

An addition of Duration to NaiveDate discards the fractional days, -rounding to the closest integral number of days towards Duration::zero().

-

Panics on underflow or overflow. -Use NaiveDate::checked_add_signed to detect that.

-

Example

-
-use chrono::{Duration, NaiveDate};
-
-let from_ymd = NaiveDate::from_ymd;
-
-assert_eq!(from_ymd(2014, 1, 1) + Duration::zero(),             from_ymd(2014, 1, 1));
-assert_eq!(from_ymd(2014, 1, 1) + Duration::seconds(86399),     from_ymd(2014, 1, 1));
-assert_eq!(from_ymd(2014, 1, 1) + Duration::seconds(-86399),    from_ymd(2014, 1, 1));
-assert_eq!(from_ymd(2014, 1, 1) + Duration::days(1),            from_ymd(2014, 1, 2));
-assert_eq!(from_ymd(2014, 1, 1) + Duration::days(-1),           from_ymd(2013, 12, 31));
-assert_eq!(from_ymd(2014, 1, 1) + Duration::days(364),          from_ymd(2014, 12, 31));
-assert_eq!(from_ymd(2014, 1, 1) + Duration::days(365*4 + 1),    from_ymd(2018, 1, 1));
-assert_eq!(from_ymd(2014, 1, 1) + Duration::days(365*400 + 97), from_ymd(2414, 1, 1));
-

type Output = NaiveDate

The resulting type after applying the + operator.

-

impl AddAssign<Duration> for NaiveDate[src]

impl Clone for NaiveDate[src]

impl Copy for NaiveDate[src]

impl Datelike for NaiveDate[src]

fn year(&self) -> i32[src]

Returns the year number in the calendar date.

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).year(), 2015);
-assert_eq!(NaiveDate::from_ymd(-308, 3, 14).year(), -308); // 309 BCE
-

fn month(&self) -> u32[src]

Returns the month number starting from 1.

-

The return value ranges from 1 to 12.

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).month(), 9);
-assert_eq!(NaiveDate::from_ymd(-308, 3, 14).month(), 3);
-

fn month0(&self) -> u32[src]

Returns the month number starting from 0.

-

The return value ranges from 0 to 11.

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).month0(), 8);
-assert_eq!(NaiveDate::from_ymd(-308, 3, 14).month0(), 2);
-

fn day(&self) -> u32[src]

Returns the day of month starting from 1.

-

The return value ranges from 1 to 31. (The last day of month differs by months.)

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).day(), 8);
-assert_eq!(NaiveDate::from_ymd(-308, 3, 14).day(), 14);
-

Combined with NaiveDate::pred, -one can determine the number of days in a particular month. -(Note that this panics when year is out of range.)

- -
-use chrono::{NaiveDate, Datelike};
-
-fn ndays_in_month(year: i32, month: u32) -> u32 {
-    // the first day of the next month...
-    let (y, m) = if month == 12 { (year + 1, 1) } else { (year, month + 1) };
-    let d = NaiveDate::from_ymd(y, m, 1);
-
-    // ...is preceded by the last day of the original month
-    d.pred().day()
-}
-
-assert_eq!(ndays_in_month(2015, 8), 31);
-assert_eq!(ndays_in_month(2015, 9), 30);
-assert_eq!(ndays_in_month(2015, 12), 31);
-assert_eq!(ndays_in_month(2016, 2), 29);
-assert_eq!(ndays_in_month(2017, 2), 28);
-

fn day0(&self) -> u32[src]

Returns the day of month starting from 0.

-

The return value ranges from 0 to 30. (The last day of month differs by months.)

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).day0(), 7);
-assert_eq!(NaiveDate::from_ymd(-308, 3, 14).day0(), 13);
-

fn ordinal(&self) -> u32[src]

Returns the day of year starting from 1.

-

The return value ranges from 1 to 366. (The last day of year differs by years.)

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).ordinal(), 251);
-assert_eq!(NaiveDate::from_ymd(-308, 3, 14).ordinal(), 74);
-

Combined with NaiveDate::pred, -one can determine the number of days in a particular year. -(Note that this panics when year is out of range.)

- -
-use chrono::{NaiveDate, Datelike};
-
-fn ndays_in_year(year: i32) -> u32 {
-    // the first day of the next year...
-    let d = NaiveDate::from_ymd(year + 1, 1, 1);
-
-    // ...is preceded by the last day of the original year
-    d.pred().ordinal()
-}
-
-assert_eq!(ndays_in_year(2015), 365);
-assert_eq!(ndays_in_year(2016), 366);
-assert_eq!(ndays_in_year(2017), 365);
-assert_eq!(ndays_in_year(2000), 366);
-assert_eq!(ndays_in_year(2100), 365);
-

fn ordinal0(&self) -> u32[src]

Returns the day of year starting from 0.

-

The return value ranges from 0 to 365. (The last day of year differs by years.)

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).ordinal0(), 250);
-assert_eq!(NaiveDate::from_ymd(-308, 3, 14).ordinal0(), 73);
-

fn weekday(&self) -> Weekday[src]

Returns the day of week.

-

Example

-
-use chrono::{NaiveDate, Datelike, Weekday};
-
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).weekday(), Weekday::Tue);
-assert_eq!(NaiveDate::from_ymd(-308, 3, 14).weekday(), Weekday::Fri);
-

fn with_year(&self, year: i32) -> Option<NaiveDate>[src]

Makes a new NaiveDate with the year number changed.

-

Returns None when the resulting NaiveDate would be invalid.

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_year(2016),
-           Some(NaiveDate::from_ymd(2016, 9, 8)));
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_year(-308),
-           Some(NaiveDate::from_ymd(-308, 9, 8)));
-

A leap day (February 29) is a good example that this method can return None.

- -
-assert!(NaiveDate::from_ymd(2016, 2, 29).with_year(2015).is_none());
-assert!(NaiveDate::from_ymd(2016, 2, 29).with_year(2020).is_some());
-

fn with_month(&self, month: u32) -> Option<NaiveDate>[src]

Makes a new NaiveDate with the month number (starting from 1) changed.

-

Returns None when the resulting NaiveDate would be invalid.

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_month(10),
-           Some(NaiveDate::from_ymd(2015, 10, 8)));
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_month(13), None); // no month 13
-assert_eq!(NaiveDate::from_ymd(2015, 9, 30).with_month(2), None); // no February 30
-

fn with_month0(&self, month0: u32) -> Option<NaiveDate>[src]

Makes a new NaiveDate with the month number (starting from 0) changed.

-

Returns None when the resulting NaiveDate would be invalid.

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_month0(9),
-           Some(NaiveDate::from_ymd(2015, 10, 8)));
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_month0(12), None); // no month 13
-assert_eq!(NaiveDate::from_ymd(2015, 9, 30).with_month0(1), None); // no February 30
-

fn with_day(&self, day: u32) -> Option<NaiveDate>[src]

Makes a new NaiveDate with the day of month (starting from 1) changed.

-

Returns None when the resulting NaiveDate would be invalid.

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_day(30),
-           Some(NaiveDate::from_ymd(2015, 9, 30)));
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_day(31),
-           None); // no September 31
-

fn with_day0(&self, day0: u32) -> Option<NaiveDate>[src]

Makes a new NaiveDate with the day of month (starting from 0) changed.

-

Returns None when the resulting NaiveDate would be invalid.

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_day0(29),
-           Some(NaiveDate::from_ymd(2015, 9, 30)));
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_day0(30),
-           None); // no September 31
-

fn with_ordinal(&self, ordinal: u32) -> Option<NaiveDate>[src]

Makes a new NaiveDate with the day of year (starting from 1) changed.

-

Returns None when the resulting NaiveDate would be invalid.

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(2015, 1, 1).with_ordinal(60),
-           Some(NaiveDate::from_ymd(2015, 3, 1)));
-assert_eq!(NaiveDate::from_ymd(2015, 1, 1).with_ordinal(366),
-           None); // 2015 had only 365 days
-
-assert_eq!(NaiveDate::from_ymd(2016, 1, 1).with_ordinal(60),
-           Some(NaiveDate::from_ymd(2016, 2, 29)));
-assert_eq!(NaiveDate::from_ymd(2016, 1, 1).with_ordinal(366),
-           Some(NaiveDate::from_ymd(2016, 12, 31)));
-

fn with_ordinal0(&self, ordinal0: u32) -> Option<NaiveDate>[src]

Makes a new NaiveDate with the day of year (starting from 0) changed.

-

Returns None when the resulting NaiveDate would be invalid.

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(2015, 1, 1).with_ordinal0(59),
-           Some(NaiveDate::from_ymd(2015, 3, 1)));
-assert_eq!(NaiveDate::from_ymd(2015, 1, 1).with_ordinal0(365),
-           None); // 2015 had only 365 days
-
-assert_eq!(NaiveDate::from_ymd(2016, 1, 1).with_ordinal0(59),
-           Some(NaiveDate::from_ymd(2016, 2, 29)));
-assert_eq!(NaiveDate::from_ymd(2016, 1, 1).with_ordinal0(365),
-           Some(NaiveDate::from_ymd(2016, 12, 31)));
-

impl Debug for NaiveDate[src]

The Debug output of the naive date d is the same as -d.format("%Y-%m-%d").

-

The string printed can be readily parsed via the parse method on str.

-

Example

-
-use chrono::NaiveDate;
-
-assert_eq!(format!("{:?}", NaiveDate::from_ymd(2015,  9,  5)), "2015-09-05");
-assert_eq!(format!("{:?}", NaiveDate::from_ymd(   0,  1,  1)), "0000-01-01");
-assert_eq!(format!("{:?}", NaiveDate::from_ymd(9999, 12, 31)), "9999-12-31");
-

ISO 8601 requires an explicit sign for years before 1 BCE or after 9999 CE.

- -
-assert_eq!(format!("{:?}", NaiveDate::from_ymd(   -1,  1,  1)),  "-0001-01-01");
-assert_eq!(format!("{:?}", NaiveDate::from_ymd(10000, 12, 31)), "+10000-12-31");
-

impl Display for NaiveDate[src]

The Display output of the naive date d is the same as -d.format("%Y-%m-%d").

-

The string printed can be readily parsed via the parse method on str.

-

Example

-
-use chrono::NaiveDate;
-
-assert_eq!(format!("{}", NaiveDate::from_ymd(2015,  9,  5)), "2015-09-05");
-assert_eq!(format!("{}", NaiveDate::from_ymd(   0,  1,  1)), "0000-01-01");
-assert_eq!(format!("{}", NaiveDate::from_ymd(9999, 12, 31)), "9999-12-31");
-

ISO 8601 requires an explicit sign for years before 1 BCE or after 9999 CE.

- -
-assert_eq!(format!("{}", NaiveDate::from_ymd(   -1,  1,  1)),  "-0001-01-01");
-assert_eq!(format!("{}", NaiveDate::from_ymd(10000, 12, 31)), "+10000-12-31");
-

impl Eq for NaiveDate[src]

impl FromStr for NaiveDate[src]

Parsing a str into a NaiveDate uses the same format, -%Y-%m-%d, as in Debug and Display.

-

Example

-
-use chrono::NaiveDate;
-
-let d = NaiveDate::from_ymd(2015, 9, 18);
-assert_eq!("2015-09-18".parse::<NaiveDate>(), Ok(d));
-
-let d = NaiveDate::from_ymd(12345, 6, 7);
-assert_eq!("+12345-6-7".parse::<NaiveDate>(), Ok(d));
-
-assert!("foo".parse::<NaiveDate>().is_err());
-

type Err = ParseError

The associated error which can be returned from parsing.

-

impl Hash for NaiveDate[src]

impl Ord for NaiveDate[src]

impl PartialEq<NaiveDate> for NaiveDate[src]

impl PartialOrd<NaiveDate> for NaiveDate[src]

impl StructuralEq for NaiveDate[src]

impl StructuralPartialEq for NaiveDate[src]

impl Sub<Duration> for NaiveDate[src]

A subtraction of Duration from NaiveDate discards the fractional days, -rounding to the closest integral number of days towards Duration::zero(). -It is the same as the addition with a negated Duration.

-

Panics on underflow or overflow. -Use NaiveDate::checked_sub_signed to detect that.

-

Example

-
-use chrono::{Duration, NaiveDate};
-
-let from_ymd = NaiveDate::from_ymd;
-
-assert_eq!(from_ymd(2014, 1, 1) - Duration::zero(),             from_ymd(2014, 1, 1));
-assert_eq!(from_ymd(2014, 1, 1) - Duration::seconds(86399),     from_ymd(2014, 1, 1));
-assert_eq!(from_ymd(2014, 1, 1) - Duration::seconds(-86399),    from_ymd(2014, 1, 1));
-assert_eq!(from_ymd(2014, 1, 1) - Duration::days(1),            from_ymd(2013, 12, 31));
-assert_eq!(from_ymd(2014, 1, 1) - Duration::days(-1),           from_ymd(2014, 1, 2));
-assert_eq!(from_ymd(2014, 1, 1) - Duration::days(364),          from_ymd(2013, 1, 2));
-assert_eq!(from_ymd(2014, 1, 1) - Duration::days(365*4 + 1),    from_ymd(2010, 1, 1));
-assert_eq!(from_ymd(2014, 1, 1) - Duration::days(365*400 + 97), from_ymd(1614, 1, 1));
-

type Output = NaiveDate

The resulting type after applying the - operator.

-

impl Sub<NaiveDate> for NaiveDate[src]

Subtracts another NaiveDate from the current date. -Returns a Duration of integral numbers.

-

This does not overflow or underflow at all, -as all possible output fits in the range of Duration.

-

The implementation is a wrapper around -NaiveDate::signed_duration_since.

-

Example

-
-use chrono::{Duration, NaiveDate};
-
-let from_ymd = NaiveDate::from_ymd;
-
-assert_eq!(from_ymd(2014, 1, 1) - from_ymd(2014, 1, 1), Duration::zero());
-assert_eq!(from_ymd(2014, 1, 1) - from_ymd(2013, 12, 31), Duration::days(1));
-assert_eq!(from_ymd(2014, 1, 1) - from_ymd(2014, 1, 2), Duration::days(-1));
-assert_eq!(from_ymd(2014, 1, 1) - from_ymd(2013, 9, 23), Duration::days(100));
-assert_eq!(from_ymd(2014, 1, 1) - from_ymd(2013, 1, 1), Duration::days(365));
-assert_eq!(from_ymd(2014, 1, 1) - from_ymd(2010, 1, 1), Duration::days(365*4 + 1));
-assert_eq!(from_ymd(2014, 1, 1) - from_ymd(1614, 1, 1), Duration::days(365*400 + 97));
-

type Output = OldDuration

The resulting type after applying the - operator.

-

impl SubAssign<Duration> for NaiveDate[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

-

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-
\ No newline at end of file diff --git a/docs/chrono/naive/struct.NaiveDateTime.html b/docs/chrono/naive/struct.NaiveDateTime.html deleted file mode 100644 index 7dae17b3..00000000 --- a/docs/chrono/naive/struct.NaiveDateTime.html +++ /dev/null @@ -1,865 +0,0 @@ -chrono::naive::NaiveDateTime - Rust - -

[][src]Struct chrono::naive::NaiveDateTime

pub struct NaiveDateTime { /* fields omitted */ }

ISO 8601 combined date and time without timezone.

-

Example

-

NaiveDateTime is commonly created from NaiveDate.

- -
-use chrono::{NaiveDate, NaiveDateTime};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2016, 7, 8).and_hms(9, 10, 11);
-

You can use typical date-like and -time-like methods, -provided that relevant traits are in the scope.

- -
-use chrono::{Datelike, Timelike, Weekday};
-
-assert_eq!(dt.weekday(), Weekday::Fri);
-assert_eq!(dt.num_seconds_from_midnight(), 33011);
-

Implementations

impl NaiveDateTime[src]

pub fn new(date: NaiveDate, time: NaiveTime) -> NaiveDateTime[src]

Makes a new NaiveDateTime from date and time components. -Equivalent to date.and_time(time) -and many other helper constructors on NaiveDate.

-

Example

-
-use chrono::{NaiveDate, NaiveTime, NaiveDateTime};
-
-let d = NaiveDate::from_ymd(2015, 6, 3);
-let t = NaiveTime::from_hms_milli(12, 34, 56, 789);
-
-let dt = NaiveDateTime::new(d, t);
-assert_eq!(dt.date(), d);
-assert_eq!(dt.time(), t);
-

pub fn from_timestamp(secs: i64, nsecs: u32) -> NaiveDateTime[src]

Makes a new NaiveDateTime corresponding to a UTC date and time, -from the number of non-leap seconds -since the midnight UTC on January 1, 1970 (aka "UNIX timestamp") -and the number of nanoseconds since the last whole non-leap second.

-

For a non-naive version of this function see -TimeZone::timestamp.

-

The nanosecond part can exceed 1,000,000,000 in order to represent the -leap second. (The true "UNIX -timestamp" cannot represent a leap second unambiguously.)

-

Panics on the out-of-range number of seconds and/or invalid nanosecond.

-

Example

-
-use chrono::{NaiveDateTime, NaiveDate};
-
-let dt = NaiveDateTime::from_timestamp(0, 42_000_000);
-assert_eq!(dt, NaiveDate::from_ymd(1970, 1, 1).and_hms_milli(0, 0, 0, 42));
-
-let dt = NaiveDateTime::from_timestamp(1_000_000_000, 0);
-assert_eq!(dt, NaiveDate::from_ymd(2001, 9, 9).and_hms(1, 46, 40));
-

pub fn from_timestamp_opt(secs: i64, nsecs: u32) -> Option<NaiveDateTime>[src]

Makes a new NaiveDateTime corresponding to a UTC date and time, -from the number of non-leap seconds -since the midnight UTC on January 1, 1970 (aka "UNIX timestamp") -and the number of nanoseconds since the last whole non-leap second.

-

The nanosecond part can exceed 1,000,000,000 -in order to represent the leap second. -(The true "UNIX timestamp" cannot represent a leap second unambiguously.)

-

Returns None on the out-of-range number of seconds and/or invalid nanosecond.

-

Example

-
-use chrono::{NaiveDateTime, NaiveDate};
-use std::i64;
-
-let from_timestamp_opt = NaiveDateTime::from_timestamp_opt;
-
-assert!(from_timestamp_opt(0, 0).is_some());
-assert!(from_timestamp_opt(0, 999_999_999).is_some());
-assert!(from_timestamp_opt(0, 1_500_000_000).is_some()); // leap second
-assert!(from_timestamp_opt(0, 2_000_000_000).is_none());
-assert!(from_timestamp_opt(i64::MAX, 0).is_none());
-

pub fn parse_from_str(s: &str, fmt: &str) -> ParseResult<NaiveDateTime>[src]

Parses a string with the specified format string and returns a new NaiveDateTime. -See the format::strftime module -on the supported escape sequences.

-

Example

-
-use chrono::{NaiveDateTime, NaiveDate};
-
-let parse_from_str = NaiveDateTime::parse_from_str;
-
-assert_eq!(parse_from_str("2015-09-05 23:56:04", "%Y-%m-%d %H:%M:%S"),
-           Ok(NaiveDate::from_ymd(2015, 9, 5).and_hms(23, 56, 4)));
-assert_eq!(parse_from_str("5sep2015pm012345.6789", "%d%b%Y%p%I%M%S%.f"),
-           Ok(NaiveDate::from_ymd(2015, 9, 5).and_hms_micro(13, 23, 45, 678_900)));
-

Offset is ignored for the purpose of parsing.

- -
-assert_eq!(parse_from_str("2014-5-17T12:34:56+09:30", "%Y-%m-%dT%H:%M:%S%z"),
-           Ok(NaiveDate::from_ymd(2014, 5, 17).and_hms(12, 34, 56)));
-

Leap seconds are correctly handled by -treating any time of the form hh:mm:60 as a leap second. -(This equally applies to the formatting, so the round trip is possible.)

- -
-assert_eq!(parse_from_str("2015-07-01 08:59:60.123", "%Y-%m-%d %H:%M:%S%.f"),
-           Ok(NaiveDate::from_ymd(2015, 7, 1).and_hms_milli(8, 59, 59, 1_123)));
-

Missing seconds are assumed to be zero, -but out-of-bound times or insufficient fields are errors otherwise.

- -
-assert_eq!(parse_from_str("94/9/4 7:15", "%y/%m/%d %H:%M"),
-           Ok(NaiveDate::from_ymd(1994, 9, 4).and_hms(7, 15, 0)));
-
-assert!(parse_from_str("04m33s", "%Mm%Ss").is_err());
-assert!(parse_from_str("94/9/4 12", "%y/%m/%d %H").is_err());
-assert!(parse_from_str("94/9/4 17:60", "%y/%m/%d %H:%M").is_err());
-assert!(parse_from_str("94/9/4 24:00:00", "%y/%m/%d %H:%M:%S").is_err());
-

All parsed fields should be consistent to each other, otherwise it's an error.

- -
-let fmt = "%Y-%m-%d %H:%M:%S = UNIX timestamp %s";
-assert!(parse_from_str("2001-09-09 01:46:39 = UNIX timestamp 999999999", fmt).is_ok());
-assert!(parse_from_str("1970-01-01 00:00:00 = UNIX timestamp 1", fmt).is_err());
-

pub fn date(&self) -> NaiveDate[src]

Retrieves a date component.

-

Example

-
-use chrono::NaiveDate;
-
-let dt = NaiveDate::from_ymd(2016, 7, 8).and_hms(9, 10, 11);
-assert_eq!(dt.date(), NaiveDate::from_ymd(2016, 7, 8));
-

pub fn time(&self) -> NaiveTime[src]

Retrieves a time component.

-

Example

-
-use chrono::{NaiveDate, NaiveTime};
-
-let dt = NaiveDate::from_ymd(2016, 7, 8).and_hms(9, 10, 11);
-assert_eq!(dt.time(), NaiveTime::from_hms(9, 10, 11));
-

pub fn timestamp(&self) -> i64[src]

Returns the number of non-leap seconds since the midnight on January 1, 1970.

-

Note that this does not account for the timezone! -The true "UNIX timestamp" would count seconds since the midnight UTC on the epoch.

-

Example

-
-use chrono::NaiveDate;
-
-let dt = NaiveDate::from_ymd(1970, 1, 1).and_hms_milli(0, 0, 1, 980);
-assert_eq!(dt.timestamp(), 1);
-
-let dt = NaiveDate::from_ymd(2001, 9, 9).and_hms(1, 46, 40);
-assert_eq!(dt.timestamp(), 1_000_000_000);
-
-let dt = NaiveDate::from_ymd(1969, 12, 31).and_hms(23, 59, 59);
-assert_eq!(dt.timestamp(), -1);
-
-let dt = NaiveDate::from_ymd(-1, 1, 1).and_hms(0, 0, 0);
-assert_eq!(dt.timestamp(), -62198755200);
-

pub fn timestamp_millis(&self) -> i64[src]

Returns the number of non-leap milliseconds since midnight on January 1, 1970.

-

Note that this does not account for the timezone! -The true "UNIX timestamp" would count seconds since the midnight UTC on the epoch.

-

Note also that this does reduce the number of years that can be -represented from ~584 Billion to ~584 Million. (If this is a problem, -please file an issue to let me know what domain needs millisecond -precision over billions of years, I'm curious.)

-

Example

-
-use chrono::NaiveDate;
-
-let dt = NaiveDate::from_ymd(1970, 1, 1).and_hms_milli(0, 0, 1, 444);
-assert_eq!(dt.timestamp_millis(), 1_444);
-
-let dt = NaiveDate::from_ymd(2001, 9, 9).and_hms_milli(1, 46, 40, 555);
-assert_eq!(dt.timestamp_millis(), 1_000_000_000_555);
-
-let dt = NaiveDate::from_ymd(1969, 12, 31).and_hms_milli(23, 59, 59, 100);
-assert_eq!(dt.timestamp_millis(), -900);
-

pub fn timestamp_nanos(&self) -> i64[src]

Returns the number of non-leap nanoseconds since midnight on January 1, 1970.

-

Note that this does not account for the timezone! -The true "UNIX timestamp" would count seconds since the midnight UTC on the epoch.

-

Panics

-

Note also that this does reduce the number of years that can be -represented from ~584 Billion to ~584 years. The dates that can be -represented as nanoseconds are between 1677-09-21T00:12:44.0 and -2262-04-11T23:47:16.854775804.

-

(If this is a problem, please file an issue to let me know what domain -needs nanosecond precision over millennia, I'm curious.)

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime};
-
-let dt = NaiveDate::from_ymd(1970, 1, 1).and_hms_nano(0, 0, 1, 444);
-assert_eq!(dt.timestamp_nanos(), 1_000_000_444);
-
-let dt = NaiveDate::from_ymd(2001, 9, 9).and_hms_nano(1, 46, 40, 555);
-
-const A_BILLION: i64 = 1_000_000_000;
-let nanos = dt.timestamp_nanos();
-assert_eq!(nanos, 1_000_000_000_000_000_555);
-assert_eq!(
-    dt,
-    NaiveDateTime::from_timestamp(nanos / A_BILLION, (nanos % A_BILLION) as u32)
-);
-

pub fn timestamp_subsec_millis(&self) -> u32[src]

Returns the number of milliseconds since the last whole non-leap second.

-

The return value ranges from 0 to 999, -or for leap seconds, to 1,999.

-

Example

-
-use chrono::NaiveDate;
-
-let dt = NaiveDate::from_ymd(2016, 7, 8).and_hms_nano(9, 10, 11, 123_456_789);
-assert_eq!(dt.timestamp_subsec_millis(), 123);
-
-let dt = NaiveDate::from_ymd(2015, 7, 1).and_hms_nano(8, 59, 59, 1_234_567_890);
-assert_eq!(dt.timestamp_subsec_millis(), 1_234);
-

pub fn timestamp_subsec_micros(&self) -> u32[src]

Returns the number of microseconds since the last whole non-leap second.

-

The return value ranges from 0 to 999,999, -or for leap seconds, to 1,999,999.

-

Example

-
-use chrono::NaiveDate;
-
-let dt = NaiveDate::from_ymd(2016, 7, 8).and_hms_nano(9, 10, 11, 123_456_789);
-assert_eq!(dt.timestamp_subsec_micros(), 123_456);
-
-let dt = NaiveDate::from_ymd(2015, 7, 1).and_hms_nano(8, 59, 59, 1_234_567_890);
-assert_eq!(dt.timestamp_subsec_micros(), 1_234_567);
-

pub fn timestamp_subsec_nanos(&self) -> u32[src]

Returns the number of nanoseconds since the last whole non-leap second.

-

The return value ranges from 0 to 999,999,999, -or for leap seconds, to 1,999,999,999.

-

Example

-
-use chrono::NaiveDate;
-
-let dt = NaiveDate::from_ymd(2016, 7, 8).and_hms_nano(9, 10, 11, 123_456_789);
-assert_eq!(dt.timestamp_subsec_nanos(), 123_456_789);
-
-let dt = NaiveDate::from_ymd(2015, 7, 1).and_hms_nano(8, 59, 59, 1_234_567_890);
-assert_eq!(dt.timestamp_subsec_nanos(), 1_234_567_890);
-

pub fn checked_add_signed(self, rhs: OldDuration) -> Option<NaiveDateTime>[src]

Adds given Duration to the current date and time.

-

As a part of Chrono's leap second handling, -the addition assumes that there is no leap second ever, -except when the NaiveDateTime itself represents a leap second -in which case the assumption becomes that there is exactly a single leap second ever.

-

Returns None when it will result in overflow.

-

Example

-
-use chrono::{Duration, NaiveDate};
-
-let from_ymd = NaiveDate::from_ymd;
-
-let d = from_ymd(2016, 7, 8);
-let hms = |h, m, s| d.and_hms(h, m, s);
-assert_eq!(hms(3, 5, 7).checked_add_signed(Duration::zero()),
-           Some(hms(3, 5, 7)));
-assert_eq!(hms(3, 5, 7).checked_add_signed(Duration::seconds(1)),
-           Some(hms(3, 5, 8)));
-assert_eq!(hms(3, 5, 7).checked_add_signed(Duration::seconds(-1)),
-           Some(hms(3, 5, 6)));
-assert_eq!(hms(3, 5, 7).checked_add_signed(Duration::seconds(3600 + 60)),
-           Some(hms(4, 6, 7)));
-assert_eq!(hms(3, 5, 7).checked_add_signed(Duration::seconds(86_400)),
-           Some(from_ymd(2016, 7, 9).and_hms(3, 5, 7)));
-
-let hmsm = |h, m, s, milli| d.and_hms_milli(h, m, s, milli);
-assert_eq!(hmsm(3, 5, 7, 980).checked_add_signed(Duration::milliseconds(450)),
-           Some(hmsm(3, 5, 8, 430)));
-

Overflow returns None.

- -
-assert_eq!(hms(3, 5, 7).checked_add_signed(Duration::days(1_000_000_000)), None);
-

Leap seconds are handled, -but the addition assumes that it is the only leap second happened.

- -
-let leap = hmsm(3, 5, 59, 1_300);
-assert_eq!(leap.checked_add_signed(Duration::zero()),
-           Some(hmsm(3, 5, 59, 1_300)));
-assert_eq!(leap.checked_add_signed(Duration::milliseconds(-500)),
-           Some(hmsm(3, 5, 59, 800)));
-assert_eq!(leap.checked_add_signed(Duration::milliseconds(500)),
-           Some(hmsm(3, 5, 59, 1_800)));
-assert_eq!(leap.checked_add_signed(Duration::milliseconds(800)),
-           Some(hmsm(3, 6, 0, 100)));
-assert_eq!(leap.checked_add_signed(Duration::seconds(10)),
-           Some(hmsm(3, 6, 9, 300)));
-assert_eq!(leap.checked_add_signed(Duration::seconds(-10)),
-           Some(hmsm(3, 5, 50, 300)));
-assert_eq!(leap.checked_add_signed(Duration::days(1)),
-           Some(from_ymd(2016, 7, 9).and_hms_milli(3, 5, 59, 300)));
-

pub fn checked_sub_signed(self, rhs: OldDuration) -> Option<NaiveDateTime>[src]

Subtracts given Duration from the current date and time.

-

As a part of Chrono's leap second handling, -the subtraction assumes that there is no leap second ever, -except when the NaiveDateTime itself represents a leap second -in which case the assumption becomes that there is exactly a single leap second ever.

-

Returns None when it will result in overflow.

-

Example

-
-use chrono::{Duration, NaiveDate};
-
-let from_ymd = NaiveDate::from_ymd;
-
-let d = from_ymd(2016, 7, 8);
-let hms = |h, m, s| d.and_hms(h, m, s);
-assert_eq!(hms(3, 5, 7).checked_sub_signed(Duration::zero()),
-           Some(hms(3, 5, 7)));
-assert_eq!(hms(3, 5, 7).checked_sub_signed(Duration::seconds(1)),
-           Some(hms(3, 5, 6)));
-assert_eq!(hms(3, 5, 7).checked_sub_signed(Duration::seconds(-1)),
-           Some(hms(3, 5, 8)));
-assert_eq!(hms(3, 5, 7).checked_sub_signed(Duration::seconds(3600 + 60)),
-           Some(hms(2, 4, 7)));
-assert_eq!(hms(3, 5, 7).checked_sub_signed(Duration::seconds(86_400)),
-           Some(from_ymd(2016, 7, 7).and_hms(3, 5, 7)));
-
-let hmsm = |h, m, s, milli| d.and_hms_milli(h, m, s, milli);
-assert_eq!(hmsm(3, 5, 7, 450).checked_sub_signed(Duration::milliseconds(670)),
-           Some(hmsm(3, 5, 6, 780)));
-

Overflow returns None.

- -
-assert_eq!(hms(3, 5, 7).checked_sub_signed(Duration::days(1_000_000_000)), None);
-

Leap seconds are handled, -but the subtraction assumes that it is the only leap second happened.

- -
-let leap = hmsm(3, 5, 59, 1_300);
-assert_eq!(leap.checked_sub_signed(Duration::zero()),
-           Some(hmsm(3, 5, 59, 1_300)));
-assert_eq!(leap.checked_sub_signed(Duration::milliseconds(200)),
-           Some(hmsm(3, 5, 59, 1_100)));
-assert_eq!(leap.checked_sub_signed(Duration::milliseconds(500)),
-           Some(hmsm(3, 5, 59, 800)));
-assert_eq!(leap.checked_sub_signed(Duration::seconds(60)),
-           Some(hmsm(3, 5, 0, 300)));
-assert_eq!(leap.checked_sub_signed(Duration::days(1)),
-           Some(from_ymd(2016, 7, 7).and_hms_milli(3, 6, 0, 300)));
-

pub fn signed_duration_since(self, rhs: NaiveDateTime) -> OldDuration[src]

Subtracts another NaiveDateTime from the current date and time. -This does not overflow or underflow at all.

-

As a part of Chrono's leap second handling, -the subtraction assumes that there is no leap second ever, -except when any of the NaiveDateTimes themselves represents a leap second -in which case the assumption becomes that -there are exactly one (or two) leap second(s) ever.

-

Example

-
-use chrono::{Duration, NaiveDate};
-
-let from_ymd = NaiveDate::from_ymd;
-
-let d = from_ymd(2016, 7, 8);
-assert_eq!(d.and_hms(3, 5, 7).signed_duration_since(d.and_hms(2, 4, 6)),
-           Duration::seconds(3600 + 60 + 1));
-
-// July 8 is 190th day in the year 2016
-let d0 = from_ymd(2016, 1, 1);
-assert_eq!(d.and_hms_milli(0, 7, 6, 500).signed_duration_since(d0.and_hms(0, 0, 0)),
-           Duration::seconds(189 * 86_400 + 7 * 60 + 6) + Duration::milliseconds(500));
-

Leap seconds are handled, but the subtraction assumes that -there were no other leap seconds happened.

- -
-let leap = from_ymd(2015, 6, 30).and_hms_milli(23, 59, 59, 1_500);
-assert_eq!(leap.signed_duration_since(from_ymd(2015, 6, 30).and_hms(23, 0, 0)),
-           Duration::seconds(3600) + Duration::milliseconds(500));
-assert_eq!(from_ymd(2015, 7, 1).and_hms(1, 0, 0).signed_duration_since(leap),
-           Duration::seconds(3600) - Duration::milliseconds(500));
-

pub fn format_with_items<'a, I, B>(&self, items: I) -> DelayedFormat<I> where
    I: Iterator<Item = B> + Clone,
    B: Borrow<Item<'a>>, 
[src]

Formats the combined date and time with the specified formatting items. -Otherwise it is the same as the ordinary format method.

-

The Iterator of items should be Cloneable, -since the resulting DelayedFormat value may be formatted multiple times.

-

Example

-
-use chrono::NaiveDate;
-use chrono::format::strftime::StrftimeItems;
-
-let fmt = StrftimeItems::new("%Y-%m-%d %H:%M:%S");
-let dt = NaiveDate::from_ymd(2015, 9, 5).and_hms(23, 56, 4);
-assert_eq!(dt.format_with_items(fmt.clone()).to_string(), "2015-09-05 23:56:04");
-assert_eq!(dt.format("%Y-%m-%d %H:%M:%S").to_string(),    "2015-09-05 23:56:04");
-

The resulting DelayedFormat can be formatted directly via the Display trait.

- -
-assert_eq!(format!("{}", dt.format_with_items(fmt)), "2015-09-05 23:56:04");
-

pub fn format<'a>(&self, fmt: &'a str) -> DelayedFormat<StrftimeItems<'a>>[src]

Formats the combined date and time with the specified format string. -See the format::strftime module -on the supported escape sequences.

-

This returns a DelayedFormat, -which gets converted to a string only when actual formatting happens. -You may use the to_string method to get a String, -or just feed it into print! and other formatting macros. -(In this way it avoids the redundant memory allocation.)

-

A wrong format string does not issue an error immediately. -Rather, converting or formatting the DelayedFormat fails. -You are recommended to immediately use DelayedFormat for this reason.

-

Example

-
-use chrono::NaiveDate;
-
-let dt = NaiveDate::from_ymd(2015, 9, 5).and_hms(23, 56, 4);
-assert_eq!(dt.format("%Y-%m-%d %H:%M:%S").to_string(), "2015-09-05 23:56:04");
-assert_eq!(dt.format("around %l %p on %b %-d").to_string(), "around 11 PM on Sep 5");
-

The resulting DelayedFormat can be formatted directly via the Display trait.

- -
-assert_eq!(format!("{}", dt.format("%Y-%m-%d %H:%M:%S")), "2015-09-05 23:56:04");
-assert_eq!(format!("{}", dt.format("around %l %p on %b %-d")), "around 11 PM on Sep 5");
-

Trait Implementations

impl Add<Duration> for NaiveDateTime[src]

An addition of Duration to NaiveDateTime yields another NaiveDateTime.

-

As a part of Chrono's leap second handling, -the addition assumes that there is no leap second ever, -except when the NaiveDateTime itself represents a leap second -in which case the assumption becomes that there is exactly a single leap second ever.

-

Panics on underflow or overflow. -Use NaiveDateTime::checked_add_signed to detect that.

-

Example

-
-use chrono::{Duration, NaiveDate};
-
-let from_ymd = NaiveDate::from_ymd;
-
-let d = from_ymd(2016, 7, 8);
-let hms = |h, m, s| d.and_hms(h, m, s);
-assert_eq!(hms(3, 5, 7) + Duration::zero(),             hms(3, 5, 7));
-assert_eq!(hms(3, 5, 7) + Duration::seconds(1),         hms(3, 5, 8));
-assert_eq!(hms(3, 5, 7) + Duration::seconds(-1),        hms(3, 5, 6));
-assert_eq!(hms(3, 5, 7) + Duration::seconds(3600 + 60), hms(4, 6, 7));
-assert_eq!(hms(3, 5, 7) + Duration::seconds(86_400),
-           from_ymd(2016, 7, 9).and_hms(3, 5, 7));
-assert_eq!(hms(3, 5, 7) + Duration::days(365),
-           from_ymd(2017, 7, 8).and_hms(3, 5, 7));
-
-let hmsm = |h, m, s, milli| d.and_hms_milli(h, m, s, milli);
-assert_eq!(hmsm(3, 5, 7, 980) + Duration::milliseconds(450), hmsm(3, 5, 8, 430));
-

Leap seconds are handled, -but the addition assumes that it is the only leap second happened.

- -
-let leap = hmsm(3, 5, 59, 1_300);
-assert_eq!(leap + Duration::zero(),             hmsm(3, 5, 59, 1_300));
-assert_eq!(leap + Duration::milliseconds(-500), hmsm(3, 5, 59, 800));
-assert_eq!(leap + Duration::milliseconds(500),  hmsm(3, 5, 59, 1_800));
-assert_eq!(leap + Duration::milliseconds(800),  hmsm(3, 6, 0, 100));
-assert_eq!(leap + Duration::seconds(10),        hmsm(3, 6, 9, 300));
-assert_eq!(leap + Duration::seconds(-10),       hmsm(3, 5, 50, 300));
-assert_eq!(leap + Duration::days(1),
-           from_ymd(2016, 7, 9).and_hms_milli(3, 5, 59, 300));
-

type Output = NaiveDateTime

The resulting type after applying the + operator.

-

impl Add<FixedOffset> for NaiveDateTime[src]

type Output = NaiveDateTime

The resulting type after applying the + operator.

-

impl AddAssign<Duration> for NaiveDateTime[src]

impl Clone for NaiveDateTime[src]

impl Copy for NaiveDateTime[src]

impl Datelike for NaiveDateTime[src]

fn year(&self) -> i32[src]

Returns the year number in the calendar date.

-

See also the NaiveDate::year method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 25).and_hms(12, 34, 56);
-assert_eq!(dt.year(), 2015);
-

fn month(&self) -> u32[src]

Returns the month number starting from 1.

-

The return value ranges from 1 to 12.

-

See also the NaiveDate::month method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 25).and_hms(12, 34, 56);
-assert_eq!(dt.month(), 9);
-

fn month0(&self) -> u32[src]

Returns the month number starting from 0.

-

The return value ranges from 0 to 11.

-

See also the NaiveDate::month0 method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 25).and_hms(12, 34, 56);
-assert_eq!(dt.month0(), 8);
-

fn day(&self) -> u32[src]

Returns the day of month starting from 1.

-

The return value ranges from 1 to 31. (The last day of month differs by months.)

-

See also the NaiveDate::day method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 25).and_hms(12, 34, 56);
-assert_eq!(dt.day(), 25);
-

fn day0(&self) -> u32[src]

Returns the day of month starting from 0.

-

The return value ranges from 0 to 30. (The last day of month differs by months.)

-

See also the NaiveDate::day0 method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 25).and_hms(12, 34, 56);
-assert_eq!(dt.day0(), 24);
-

fn ordinal(&self) -> u32[src]

Returns the day of year starting from 1.

-

The return value ranges from 1 to 366. (The last day of year differs by years.)

-

See also the NaiveDate::ordinal method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 25).and_hms(12, 34, 56);
-assert_eq!(dt.ordinal(), 268);
-

fn ordinal0(&self) -> u32[src]

Returns the day of year starting from 0.

-

The return value ranges from 0 to 365. (The last day of year differs by years.)

-

See also the NaiveDate::ordinal0 method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 25).and_hms(12, 34, 56);
-assert_eq!(dt.ordinal0(), 267);
-

fn weekday(&self) -> Weekday[src]

Returns the day of week.

-

See also the NaiveDate::weekday method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike, Weekday};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 25).and_hms(12, 34, 56);
-assert_eq!(dt.weekday(), Weekday::Fri);
-

fn with_year(&self, year: i32) -> Option<NaiveDateTime>[src]

Makes a new NaiveDateTime with the year number changed.

-

Returns None when the resulting NaiveDateTime would be invalid.

-

See also the -NaiveDate::with_year method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 25).and_hms(12, 34, 56);
-assert_eq!(dt.with_year(2016), Some(NaiveDate::from_ymd(2016, 9, 25).and_hms(12, 34, 56)));
-assert_eq!(dt.with_year(-308), Some(NaiveDate::from_ymd(-308, 9, 25).and_hms(12, 34, 56)));
-

fn with_month(&self, month: u32) -> Option<NaiveDateTime>[src]

Makes a new NaiveDateTime with the month number (starting from 1) changed.

-

Returns None when the resulting NaiveDateTime would be invalid.

-

See also the -NaiveDate::with_month method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 30).and_hms(12, 34, 56);
-assert_eq!(dt.with_month(10), Some(NaiveDate::from_ymd(2015, 10, 30).and_hms(12, 34, 56)));
-assert_eq!(dt.with_month(13), None); // no month 13
-assert_eq!(dt.with_month(2), None); // no February 30
-

fn with_month0(&self, month0: u32) -> Option<NaiveDateTime>[src]

Makes a new NaiveDateTime with the month number (starting from 0) changed.

-

Returns None when the resulting NaiveDateTime would be invalid.

-

See also the -NaiveDate::with_month0 method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 30).and_hms(12, 34, 56);
-assert_eq!(dt.with_month0(9), Some(NaiveDate::from_ymd(2015, 10, 30).and_hms(12, 34, 56)));
-assert_eq!(dt.with_month0(12), None); // no month 13
-assert_eq!(dt.with_month0(1), None); // no February 30
-

fn with_day(&self, day: u32) -> Option<NaiveDateTime>[src]

Makes a new NaiveDateTime with the day of month (starting from 1) changed.

-

Returns None when the resulting NaiveDateTime would be invalid.

-

See also the -NaiveDate::with_day method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 8).and_hms(12, 34, 56);
-assert_eq!(dt.with_day(30), Some(NaiveDate::from_ymd(2015, 9, 30).and_hms(12, 34, 56)));
-assert_eq!(dt.with_day(31), None); // no September 31
-

fn with_day0(&self, day0: u32) -> Option<NaiveDateTime>[src]

Makes a new NaiveDateTime with the day of month (starting from 0) changed.

-

Returns None when the resulting NaiveDateTime would be invalid.

-

See also the -NaiveDate::with_day0 method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 8).and_hms(12, 34, 56);
-assert_eq!(dt.with_day0(29), Some(NaiveDate::from_ymd(2015, 9, 30).and_hms(12, 34, 56)));
-assert_eq!(dt.with_day0(30), None); // no September 31
-

fn with_ordinal(&self, ordinal: u32) -> Option<NaiveDateTime>[src]

Makes a new NaiveDateTime with the day of year (starting from 1) changed.

-

Returns None when the resulting NaiveDateTime would be invalid.

-

See also the -NaiveDate::with_ordinal method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 8).and_hms(12, 34, 56);
-assert_eq!(dt.with_ordinal(60),
-           Some(NaiveDate::from_ymd(2015, 3, 1).and_hms(12, 34, 56)));
-assert_eq!(dt.with_ordinal(366), None); // 2015 had only 365 days
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2016, 9, 8).and_hms(12, 34, 56);
-assert_eq!(dt.with_ordinal(60),
-           Some(NaiveDate::from_ymd(2016, 2, 29).and_hms(12, 34, 56)));
-assert_eq!(dt.with_ordinal(366),
-           Some(NaiveDate::from_ymd(2016, 12, 31).and_hms(12, 34, 56)));
-

fn with_ordinal0(&self, ordinal0: u32) -> Option<NaiveDateTime>[src]

Makes a new NaiveDateTime with the day of year (starting from 0) changed.

-

Returns None when the resulting NaiveDateTime would be invalid.

-

See also the -NaiveDate::with_ordinal0 method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 8).and_hms(12, 34, 56);
-assert_eq!(dt.with_ordinal0(59),
-           Some(NaiveDate::from_ymd(2015, 3, 1).and_hms(12, 34, 56)));
-assert_eq!(dt.with_ordinal0(365), None); // 2015 had only 365 days
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2016, 9, 8).and_hms(12, 34, 56);
-assert_eq!(dt.with_ordinal0(59),
-           Some(NaiveDate::from_ymd(2016, 2, 29).and_hms(12, 34, 56)));
-assert_eq!(dt.with_ordinal0(365),
-           Some(NaiveDate::from_ymd(2016, 12, 31).and_hms(12, 34, 56)));
-

impl Debug for NaiveDateTime[src]

The Debug output of the naive date and time dt is the same as -dt.format("%Y-%m-%dT%H:%M:%S%.f").

-

The string printed can be readily parsed via the parse method on str.

-

It should be noted that, for leap seconds not on the minute boundary, -it may print a representation not distinguishable from non-leap seconds. -This doesn't matter in practice, since such leap seconds never happened. -(By the time of the first leap second on 1972-06-30, -every time zone offset around the world has standardized to the 5-minute alignment.)

-

Example

-
-use chrono::NaiveDate;
-
-let dt = NaiveDate::from_ymd(2016, 11, 15).and_hms(7, 39, 24);
-assert_eq!(format!("{:?}", dt), "2016-11-15T07:39:24");
-

Leap seconds may also be used.

- -
-let dt = NaiveDate::from_ymd(2015, 6, 30).and_hms_milli(23, 59, 59, 1_500);
-assert_eq!(format!("{:?}", dt), "2015-06-30T23:59:60.500");
-

impl Display for NaiveDateTime[src]

The Display output of the naive date and time dt is the same as -dt.format("%Y-%m-%d %H:%M:%S%.f").

-

It should be noted that, for leap seconds not on the minute boundary, -it may print a representation not distinguishable from non-leap seconds. -This doesn't matter in practice, since such leap seconds never happened. -(By the time of the first leap second on 1972-06-30, -every time zone offset around the world has standardized to the 5-minute alignment.)

-

Example

-
-use chrono::NaiveDate;
-
-let dt = NaiveDate::from_ymd(2016, 11, 15).and_hms(7, 39, 24);
-assert_eq!(format!("{}", dt), "2016-11-15 07:39:24");
-

Leap seconds may also be used.

- -
-let dt = NaiveDate::from_ymd(2015, 6, 30).and_hms_milli(23, 59, 59, 1_500);
-assert_eq!(format!("{}", dt), "2015-06-30 23:59:60.500");
-

impl Eq for NaiveDateTime[src]

impl FromStr for NaiveDateTime[src]

Parsing a str into a NaiveDateTime uses the same format, -%Y-%m-%dT%H:%M:%S%.f, as in Debug.

-

Example

-
-use chrono::{NaiveDateTime, NaiveDate};
-
-let dt = NaiveDate::from_ymd(2015, 9, 18).and_hms(23, 56, 4);
-assert_eq!("2015-09-18T23:56:04".parse::<NaiveDateTime>(), Ok(dt));
-
-let dt = NaiveDate::from_ymd(12345, 6, 7).and_hms_milli(7, 59, 59, 1_500); // leap second
-assert_eq!("+12345-6-7T7:59:60.5".parse::<NaiveDateTime>(), Ok(dt));
-
-assert!("foo".parse::<NaiveDateTime>().is_err());
-

type Err = ParseError

The associated error which can be returned from parsing.

-

impl Hash for NaiveDateTime[src]

NaiveDateTime can be used as a key to the hash maps (in principle).

-

Practically this also takes account of fractional seconds, so it is not recommended. -(For the obvious reason this also distinguishes leap seconds from non-leap seconds.)

-

impl Ord for NaiveDateTime[src]

impl PartialEq<NaiveDateTime> for NaiveDateTime[src]

impl PartialOrd<NaiveDateTime> for NaiveDateTime[src]

impl StructuralEq for NaiveDateTime[src]

impl StructuralPartialEq for NaiveDateTime[src]

impl Sub<Duration> for NaiveDateTime[src]

A subtraction of Duration from NaiveDateTime yields another NaiveDateTime. -It is the same as the addition with a negated Duration.

-

As a part of Chrono's leap second handling, -the addition assumes that there is no leap second ever, -except when the NaiveDateTime itself represents a leap second -in which case the assumption becomes that there is exactly a single leap second ever.

-

Panics on underflow or overflow. -Use NaiveDateTime::checked_sub_signed to detect that.

-

Example

-
-use chrono::{Duration, NaiveDate};
-
-let from_ymd = NaiveDate::from_ymd;
-
-let d = from_ymd(2016, 7, 8);
-let hms = |h, m, s| d.and_hms(h, m, s);
-assert_eq!(hms(3, 5, 7) - Duration::zero(),             hms(3, 5, 7));
-assert_eq!(hms(3, 5, 7) - Duration::seconds(1),         hms(3, 5, 6));
-assert_eq!(hms(3, 5, 7) - Duration::seconds(-1),        hms(3, 5, 8));
-assert_eq!(hms(3, 5, 7) - Duration::seconds(3600 + 60), hms(2, 4, 7));
-assert_eq!(hms(3, 5, 7) - Duration::seconds(86_400),
-           from_ymd(2016, 7, 7).and_hms(3, 5, 7));
-assert_eq!(hms(3, 5, 7) - Duration::days(365),
-           from_ymd(2015, 7, 9).and_hms(3, 5, 7));
-
-let hmsm = |h, m, s, milli| d.and_hms_milli(h, m, s, milli);
-assert_eq!(hmsm(3, 5, 7, 450) - Duration::milliseconds(670), hmsm(3, 5, 6, 780));
-

Leap seconds are handled, -but the subtraction assumes that it is the only leap second happened.

- -
-let leap = hmsm(3, 5, 59, 1_300);
-assert_eq!(leap - Duration::zero(),            hmsm(3, 5, 59, 1_300));
-assert_eq!(leap - Duration::milliseconds(200), hmsm(3, 5, 59, 1_100));
-assert_eq!(leap - Duration::milliseconds(500), hmsm(3, 5, 59, 800));
-assert_eq!(leap - Duration::seconds(60),       hmsm(3, 5, 0, 300));
-assert_eq!(leap - Duration::days(1),
-           from_ymd(2016, 7, 7).and_hms_milli(3, 6, 0, 300));
-

type Output = NaiveDateTime

The resulting type after applying the - operator.

-

impl Sub<FixedOffset> for NaiveDateTime[src]

type Output = NaiveDateTime

The resulting type after applying the - operator.

-

impl Sub<NaiveDateTime> for NaiveDateTime[src]

Subtracts another NaiveDateTime from the current date and time. -This does not overflow or underflow at all.

-

As a part of Chrono's leap second handling, -the subtraction assumes that there is no leap second ever, -except when any of the NaiveDateTimes themselves represents a leap second -in which case the assumption becomes that -there are exactly one (or two) leap second(s) ever.

-

The implementation is a wrapper around -NaiveDateTime::signed_duration_since.

-

Example

-
-use chrono::{Duration, NaiveDate};
-
-let from_ymd = NaiveDate::from_ymd;
-
-let d = from_ymd(2016, 7, 8);
-assert_eq!(d.and_hms(3, 5, 7) - d.and_hms(2, 4, 6), Duration::seconds(3600 + 60 + 1));
-
-// July 8 is 190th day in the year 2016
-let d0 = from_ymd(2016, 1, 1);
-assert_eq!(d.and_hms_milli(0, 7, 6, 500) - d0.and_hms(0, 0, 0),
-           Duration::seconds(189 * 86_400 + 7 * 60 + 6) + Duration::milliseconds(500));
-

Leap seconds are handled, but the subtraction assumes that -there were no other leap seconds happened.

- -
-let leap = from_ymd(2015, 6, 30).and_hms_milli(23, 59, 59, 1_500);
-assert_eq!(leap - from_ymd(2015, 6, 30).and_hms(23, 0, 0),
-           Duration::seconds(3600) + Duration::milliseconds(500));
-assert_eq!(from_ymd(2015, 7, 1).and_hms(1, 0, 0) - leap,
-           Duration::seconds(3600) - Duration::milliseconds(500));
-

type Output = OldDuration

The resulting type after applying the - operator.

-

impl SubAssign<Duration> for NaiveDateTime[src]

impl Timelike for NaiveDateTime[src]

fn hour(&self) -> u32[src]

Returns the hour number from 0 to 23.

-

See also the NaiveTime::hour method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Timelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 8).and_hms_milli(12, 34, 56, 789);
-assert_eq!(dt.hour(), 12);
-

fn minute(&self) -> u32[src]

Returns the minute number from 0 to 59.

-

See also the NaiveTime::minute method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Timelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 8).and_hms_milli(12, 34, 56, 789);
-assert_eq!(dt.minute(), 34);
-

fn second(&self) -> u32[src]

Returns the second number from 0 to 59.

-

See also the NaiveTime::second method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Timelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 8).and_hms_milli(12, 34, 56, 789);
-assert_eq!(dt.second(), 56);
-

fn nanosecond(&self) -> u32[src]

Returns the number of nanoseconds since the whole non-leap second. -The range from 1,000,000,000 to 1,999,999,999 represents -the leap second.

-

See also the -NaiveTime::nanosecond method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Timelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 8).and_hms_milli(12, 34, 56, 789);
-assert_eq!(dt.nanosecond(), 789_000_000);
-

fn with_hour(&self, hour: u32) -> Option<NaiveDateTime>[src]

Makes a new NaiveDateTime with the hour number changed.

-

Returns None when the resulting NaiveDateTime would be invalid.

-

See also the -NaiveTime::with_hour method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Timelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 8).and_hms_milli(12, 34, 56, 789);
-assert_eq!(dt.with_hour(7),
-           Some(NaiveDate::from_ymd(2015, 9, 8).and_hms_milli(7, 34, 56, 789)));
-assert_eq!(dt.with_hour(24), None);
-

fn with_minute(&self, min: u32) -> Option<NaiveDateTime>[src]

Makes a new NaiveDateTime with the minute number changed.

-

Returns None when the resulting NaiveDateTime would be invalid.

-

See also the -NaiveTime::with_minute method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Timelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 8).and_hms_milli(12, 34, 56, 789);
-assert_eq!(dt.with_minute(45),
-           Some(NaiveDate::from_ymd(2015, 9, 8).and_hms_milli(12, 45, 56, 789)));
-assert_eq!(dt.with_minute(60), None);
-

fn with_second(&self, sec: u32) -> Option<NaiveDateTime>[src]

Makes a new NaiveDateTime with the second number changed.

-

Returns None when the resulting NaiveDateTime would be invalid. -As with the second method, -the input range is restricted to 0 through 59.

-

See also the -NaiveTime::with_second method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Timelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 8).and_hms_milli(12, 34, 56, 789);
-assert_eq!(dt.with_second(17),
-           Some(NaiveDate::from_ymd(2015, 9, 8).and_hms_milli(12, 34, 17, 789)));
-assert_eq!(dt.with_second(60), None);
-

fn with_nanosecond(&self, nano: u32) -> Option<NaiveDateTime>[src]

Makes a new NaiveDateTime with nanoseconds since the whole non-leap second changed.

-

Returns None when the resulting NaiveDateTime would be invalid. -As with the nanosecond method, -the input range can exceed 1,000,000,000 for leap seconds.

-

See also the -NaiveTime::with_nanosecond -method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Timelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 8).and_hms_milli(12, 34, 56, 789);
-assert_eq!(dt.with_nanosecond(333_333_333),
-           Some(NaiveDate::from_ymd(2015, 9, 8).and_hms_nano(12, 34, 56, 333_333_333)));
-assert_eq!(dt.with_nanosecond(1_333_333_333), // leap second
-           Some(NaiveDate::from_ymd(2015, 9, 8).and_hms_nano(12, 34, 56, 1_333_333_333)));
-assert_eq!(dt.with_nanosecond(2_000_000_000), None);
-

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

-

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-
\ No newline at end of file diff --git a/docs/chrono/naive/struct.NaiveTime.html b/docs/chrono/naive/struct.NaiveTime.html deleted file mode 100644 index 5ee899c5..00000000 --- a/docs/chrono/naive/struct.NaiveTime.html +++ /dev/null @@ -1,779 +0,0 @@ -chrono::naive::NaiveTime - Rust - -

[][src]Struct chrono::naive::NaiveTime

pub struct NaiveTime { /* fields omitted */ }

ISO 8601 time without timezone. -Allows for the nanosecond precision and optional leap second representation.

-

Leap Second Handling

-

Since 1960s, the manmade atomic clock has been so accurate that -it is much more accurate than Earth's own motion. -It became desirable to define the civil time in terms of the atomic clock, -but that risks the desynchronization of the civil time from Earth. -To account for this, the designers of the Coordinated Universal Time (UTC) -made that the UTC should be kept within 0.9 seconds of the observed Earth-bound time. -When the mean solar day is longer than the ideal (86,400 seconds), -the error slowly accumulates and it is necessary to add a leap second -to slow the UTC down a bit. -(We may also remove a second to speed the UTC up a bit, but it never happened.) -The leap second, if any, follows 23:59:59 of June 30 or December 31 in the UTC.

-

Fast forward to the 21st century, -we have seen 26 leap seconds from January 1972 to December 2015. -Yes, 26 seconds. Probably you can read this paragraph within 26 seconds. -But those 26 seconds, and possibly more in the future, are never predictable, -and whether to add a leap second or not is known only before 6 months. -Internet-based clocks (via NTP) do account for known leap seconds, -but the system API normally doesn't (and often can't, with no network connection) -and there is no reliable way to retrieve leap second information.

-

Chrono does not try to accurately implement leap seconds; it is impossible. -Rather, it allows for leap seconds but behaves as if there are no other leap seconds. -Various operations will ignore any possible leap second(s) -except when any of the operands were actually leap seconds.

-

If you cannot tolerate this behavior, -you must use a separate TimeZone for the International Atomic Time (TAI). -TAI is like UTC but has no leap seconds, and thus slightly differs from UTC. -Chrono does not yet provide such implementation, but it is planned.

-

Representing Leap Seconds

-

The leap second is indicated via fractional seconds more than 1 second. -This makes possible to treat a leap second as the prior non-leap second -if you don't care about sub-second accuracy. -You should use the proper formatting to get the raw leap second.

-

All methods accepting fractional seconds will accept such values.

- -
-use chrono::{NaiveDate, NaiveTime, Utc, TimeZone};
-
-let t = NaiveTime::from_hms_milli(8, 59, 59, 1_000);
-
-let dt1 = NaiveDate::from_ymd(2015, 7, 1).and_hms_micro(8, 59, 59, 1_000_000);
-
-let dt2 = Utc.ymd(2015, 6, 30).and_hms_nano(23, 59, 59, 1_000_000_000);
-

Note that the leap second can happen anytime given an appropriate time zone; -2015-07-01 01:23:60 would be a proper leap second if UTC+01:24 had existed. -Practically speaking, though, by the time of the first leap second on 1972-06-30, -every time zone offset around the world has standardized to the 5-minute alignment.

-

Date And Time Arithmetics

-

As a concrete example, let's assume that 03:00:60 and 04:00:60 are leap seconds. -In reality, of course, leap seconds are separated by at least 6 months. -We will also use some intuitive concise notations for the explanation.

-

Time + Duration -(short for NaiveTime::overflowing_add_signed):

-
    -
  • 03:00:00 + 1s = 03:00:01.
  • -
  • 03:00:59 + 60s = 03:02:00.
  • -
  • 03:00:59 + 1s = 03:01:00.
  • -
  • 03:00:60 + 1s = 03:01:00. -Note that the sum is identical to the previous.
  • -
  • 03:00:60 + 60s = 03:01:59.
  • -
  • 03:00:60 + 61s = 03:02:00.
  • -
  • 03:00:60.1 + 0.8s = 03:00:60.9.
  • -
-

Time - Duration -(short for NaiveTime::overflowing_sub_signed):

-
    -
  • 03:00:00 - 1s = 02:59:59.
  • -
  • 03:01:00 - 1s = 03:00:59.
  • -
  • 03:01:00 - 60s = 03:00:00.
  • -
  • 03:00:60 - 60s = 03:00:00. -Note that the result is identical to the previous.
  • -
  • 03:00:60.7 - 0.4s = 03:00:60.3.
  • -
  • 03:00:60.7 - 0.9s = 03:00:59.8.
  • -
-

Time - Time -(short for NaiveTime::signed_duration_since):

-
    -
  • 04:00:00 - 03:00:00 = 3600s.
  • -
  • 03:01:00 - 03:00:00 = 60s.
  • -
  • 03:00:60 - 03:00:00 = 60s. -Note that the difference is identical to the previous.
  • -
  • 03:00:60.6 - 03:00:59.4 = 1.2s.
  • -
  • 03:01:00 - 03:00:59.8 = 0.2s.
  • -
  • 03:01:00 - 03:00:60.5 = 0.5s. -Note that the difference is larger than the previous, -even though the leap second clearly follows the previous whole second.
  • -
  • 04:00:60.9 - 03:00:60.1 = (04:00:60.9 - 04:00:00) + (04:00:00 - 03:01:00) + (03:01:00 - 03:00:60.1) = 60.9s + 3540s + 0.9s = 3601.8s.
  • -
-

In general,

-
    -
  • -

    Time + Duration unconditionally equals to Duration + Time.

    -
  • -
  • -

    Time - Duration unconditionally equals to Time + (-Duration).

    -
  • -
  • -

    Time1 - Time2 unconditionally equals to -(Time2 - Time1).

    -
  • -
  • -

    Associativity does not generally hold, because -(Time + Duration1) - Duration2 no longer equals to Time + (Duration1 - Duration2) -for two positive durations.

    -
      -
    • -

      As a special case, (Time + Duration) - Duration also does not equal to Time.

      -
    • -
    • -

      If you can assume that all durations have the same sign, however, -then the associativity holds: -(Time + Duration1) + Duration2 equals to Time + (Duration1 + Duration2) -for two positive durations.

      -
    • -
    -
  • -
-

Reading And Writing Leap Seconds

-

The "typical" leap seconds on the minute boundary are -correctly handled both in the formatting and parsing. -The leap second in the human-readable representation -will be represented as the second part being 60, as required by ISO 8601.

- -
-use chrono::{Utc, TimeZone};
-
-let dt = Utc.ymd(2015, 6, 30).and_hms_milli(23, 59, 59, 1_000);
-assert_eq!(format!("{:?}", dt), "2015-06-30T23:59:60Z");
-

There are hypothetical leap seconds not on the minute boundary -nevertheless supported by Chrono. -They are allowed for the sake of completeness and consistency; -there were several "exotic" time zone offsets with fractional minutes prior to UTC after all. -For such cases the human-readable representation is ambiguous -and would be read back to the next non-leap second.

- -
-use chrono::{DateTime, Utc, TimeZone};
-
-let dt = Utc.ymd(2015, 6, 30).and_hms_milli(23, 56, 4, 1_000);
-assert_eq!(format!("{:?}", dt), "2015-06-30T23:56:05Z");
-
-let dt = Utc.ymd(2015, 6, 30).and_hms(23, 56, 5);
-assert_eq!(format!("{:?}", dt), "2015-06-30T23:56:05Z");
-assert_eq!(DateTime::parse_from_rfc3339("2015-06-30T23:56:05Z").unwrap(), dt);
-

Since Chrono alone cannot determine any existence of leap seconds, -there is absolutely no guarantee that the leap second read has actually happened.

-

Implementations

impl NaiveTime[src]

pub fn from_hms(hour: u32, min: u32, sec: u32) -> NaiveTime[src]

Makes a new NaiveTime from hour, minute and second.

-

No leap second is allowed here; -use NaiveTime::from_hms_* methods with a subsecond parameter instead.

-

Panics on invalid hour, minute and/or second.

-

Example

-
-use chrono::{NaiveTime, Timelike};
-
-let t = NaiveTime::from_hms(23, 56, 4);
-assert_eq!(t.hour(), 23);
-assert_eq!(t.minute(), 56);
-assert_eq!(t.second(), 4);
-assert_eq!(t.nanosecond(), 0);
-

pub fn from_hms_opt(hour: u32, min: u32, sec: u32) -> Option<NaiveTime>[src]

Makes a new NaiveTime from hour, minute and second.

-

No leap second is allowed here; -use NaiveTime::from_hms_*_opt methods with a subsecond parameter instead.

-

Returns None on invalid hour, minute and/or second.

-

Example

-
-use chrono::NaiveTime;
-
-let from_hms_opt = NaiveTime::from_hms_opt;
-
-assert!(from_hms_opt(0, 0, 0).is_some());
-assert!(from_hms_opt(23, 59, 59).is_some());
-assert!(from_hms_opt(24, 0, 0).is_none());
-assert!(from_hms_opt(23, 60, 0).is_none());
-assert!(from_hms_opt(23, 59, 60).is_none());
-

pub fn from_hms_milli(hour: u32, min: u32, sec: u32, milli: u32) -> NaiveTime[src]

Makes a new NaiveTime from hour, minute, second and millisecond.

-

The millisecond part can exceed 1,000 -in order to represent the leap second.

-

Panics on invalid hour, minute, second and/or millisecond.

-

Example

-
-use chrono::{NaiveTime, Timelike};
-
-let t = NaiveTime::from_hms_milli(23, 56, 4, 12);
-assert_eq!(t.hour(), 23);
-assert_eq!(t.minute(), 56);
-assert_eq!(t.second(), 4);
-assert_eq!(t.nanosecond(), 12_000_000);
-

pub fn from_hms_milli_opt(
    hour: u32,
    min: u32,
    sec: u32,
    milli: u32
) -> Option<NaiveTime>
[src]

Makes a new NaiveTime from hour, minute, second and millisecond.

-

The millisecond part can exceed 1,000 -in order to represent the leap second.

-

Returns None on invalid hour, minute, second and/or millisecond.

-

Example

-
-use chrono::NaiveTime;
-
-let from_hmsm_opt = NaiveTime::from_hms_milli_opt;
-
-assert!(from_hmsm_opt(0, 0, 0, 0).is_some());
-assert!(from_hmsm_opt(23, 59, 59, 999).is_some());
-assert!(from_hmsm_opt(23, 59, 59, 1_999).is_some()); // a leap second after 23:59:59
-assert!(from_hmsm_opt(24, 0, 0, 0).is_none());
-assert!(from_hmsm_opt(23, 60, 0, 0).is_none());
-assert!(from_hmsm_opt(23, 59, 60, 0).is_none());
-assert!(from_hmsm_opt(23, 59, 59, 2_000).is_none());
-

pub fn from_hms_micro(hour: u32, min: u32, sec: u32, micro: u32) -> NaiveTime[src]

Makes a new NaiveTime from hour, minute, second and microsecond.

-

The microsecond part can exceed 1,000,000 -in order to represent the leap second.

-

Panics on invalid hour, minute, second and/or microsecond.

-

Example

-
-use chrono::{NaiveTime, Timelike};
-
-let t = NaiveTime::from_hms_micro(23, 56, 4, 12_345);
-assert_eq!(t.hour(), 23);
-assert_eq!(t.minute(), 56);
-assert_eq!(t.second(), 4);
-assert_eq!(t.nanosecond(), 12_345_000);
-

pub fn from_hms_micro_opt(
    hour: u32,
    min: u32,
    sec: u32,
    micro: u32
) -> Option<NaiveTime>
[src]

Makes a new NaiveTime from hour, minute, second and microsecond.

-

The microsecond part can exceed 1,000,000 -in order to represent the leap second.

-

Returns None on invalid hour, minute, second and/or microsecond.

-

Example

-
-use chrono::NaiveTime;
-
-let from_hmsu_opt = NaiveTime::from_hms_micro_opt;
-
-assert!(from_hmsu_opt(0, 0, 0, 0).is_some());
-assert!(from_hmsu_opt(23, 59, 59, 999_999).is_some());
-assert!(from_hmsu_opt(23, 59, 59, 1_999_999).is_some()); // a leap second after 23:59:59
-assert!(from_hmsu_opt(24, 0, 0, 0).is_none());
-assert!(from_hmsu_opt(23, 60, 0, 0).is_none());
-assert!(from_hmsu_opt(23, 59, 60, 0).is_none());
-assert!(from_hmsu_opt(23, 59, 59, 2_000_000).is_none());
-

pub fn from_hms_nano(hour: u32, min: u32, sec: u32, nano: u32) -> NaiveTime[src]

Makes a new NaiveTime from hour, minute, second and nanosecond.

-

The nanosecond part can exceed 1,000,000,000 -in order to represent the leap second.

-

Panics on invalid hour, minute, second and/or nanosecond.

-

Example

-
-use chrono::{NaiveTime, Timelike};
-
-let t = NaiveTime::from_hms_nano(23, 56, 4, 12_345_678);
-assert_eq!(t.hour(), 23);
-assert_eq!(t.minute(), 56);
-assert_eq!(t.second(), 4);
-assert_eq!(t.nanosecond(), 12_345_678);
-

pub fn from_hms_nano_opt(
    hour: u32,
    min: u32,
    sec: u32,
    nano: u32
) -> Option<NaiveTime>
[src]

Makes a new NaiveTime from hour, minute, second and nanosecond.

-

The nanosecond part can exceed 1,000,000,000 -in order to represent the leap second.

-

Returns None on invalid hour, minute, second and/or nanosecond.

-

Example

-
-use chrono::NaiveTime;
-
-let from_hmsn_opt = NaiveTime::from_hms_nano_opt;
-
-assert!(from_hmsn_opt(0, 0, 0, 0).is_some());
-assert!(from_hmsn_opt(23, 59, 59, 999_999_999).is_some());
-assert!(from_hmsn_opt(23, 59, 59, 1_999_999_999).is_some()); // a leap second after 23:59:59
-assert!(from_hmsn_opt(24, 0, 0, 0).is_none());
-assert!(from_hmsn_opt(23, 60, 0, 0).is_none());
-assert!(from_hmsn_opt(23, 59, 60, 0).is_none());
-assert!(from_hmsn_opt(23, 59, 59, 2_000_000_000).is_none());
-

pub fn from_num_seconds_from_midnight(secs: u32, nano: u32) -> NaiveTime[src]

Makes a new NaiveTime from the number of seconds since midnight and nanosecond.

-

The nanosecond part can exceed 1,000,000,000 -in order to represent the leap second.

-

Panics on invalid number of seconds and/or nanosecond.

-

Example

-
-use chrono::{NaiveTime, Timelike};
-
-let t = NaiveTime::from_num_seconds_from_midnight(86164, 12_345_678);
-assert_eq!(t.hour(), 23);
-assert_eq!(t.minute(), 56);
-assert_eq!(t.second(), 4);
-assert_eq!(t.nanosecond(), 12_345_678);
-

pub fn from_num_seconds_from_midnight_opt(
    secs: u32,
    nano: u32
) -> Option<NaiveTime>
[src]

Makes a new NaiveTime from the number of seconds since midnight and nanosecond.

-

The nanosecond part can exceed 1,000,000,000 -in order to represent the leap second.

-

Returns None on invalid number of seconds and/or nanosecond.

-

Example

-
-use chrono::NaiveTime;
-
-let from_nsecs_opt = NaiveTime::from_num_seconds_from_midnight_opt;
-
-assert!(from_nsecs_opt(0, 0).is_some());
-assert!(from_nsecs_opt(86399, 999_999_999).is_some());
-assert!(from_nsecs_opt(86399, 1_999_999_999).is_some()); // a leap second after 23:59:59
-assert!(from_nsecs_opt(86_400, 0).is_none());
-assert!(from_nsecs_opt(86399, 2_000_000_000).is_none());
-

pub fn parse_from_str(s: &str, fmt: &str) -> ParseResult<NaiveTime>[src]

Parses a string with the specified format string and returns a new NaiveTime. -See the format::strftime module -on the supported escape sequences.

-

Example

-
-use chrono::NaiveTime;
-
-let parse_from_str = NaiveTime::parse_from_str;
-
-assert_eq!(parse_from_str("23:56:04", "%H:%M:%S"),
-           Ok(NaiveTime::from_hms(23, 56, 4)));
-assert_eq!(parse_from_str("pm012345.6789", "%p%I%M%S%.f"),
-           Ok(NaiveTime::from_hms_micro(13, 23, 45, 678_900)));
-

Date and offset is ignored for the purpose of parsing.

- -
-assert_eq!(parse_from_str("2014-5-17T12:34:56+09:30", "%Y-%m-%dT%H:%M:%S%z"),
-           Ok(NaiveTime::from_hms(12, 34, 56)));
-

Leap seconds are correctly handled by -treating any time of the form hh:mm:60 as a leap second. -(This equally applies to the formatting, so the round trip is possible.)

- -
-assert_eq!(parse_from_str("08:59:60.123", "%H:%M:%S%.f"),
-           Ok(NaiveTime::from_hms_milli(8, 59, 59, 1_123)));
-

Missing seconds are assumed to be zero, -but out-of-bound times or insufficient fields are errors otherwise.

- -
-assert_eq!(parse_from_str("7:15", "%H:%M"),
-           Ok(NaiveTime::from_hms(7, 15, 0)));
-
-assert!(parse_from_str("04m33s", "%Mm%Ss").is_err());
-assert!(parse_from_str("12", "%H").is_err());
-assert!(parse_from_str("17:60", "%H:%M").is_err());
-assert!(parse_from_str("24:00:00", "%H:%M:%S").is_err());
-

All parsed fields should be consistent to each other, otherwise it's an error. -Here %H is for 24-hour clocks, unlike %I, -and thus can be independently determined without AM/PM.

- -
-assert!(parse_from_str("13:07 AM", "%H:%M %p").is_err());
-

pub fn overflowing_add_signed(&self, rhs: OldDuration) -> (NaiveTime, i64)[src]

Adds given Duration to the current time, -and also returns the number of seconds -in the integral number of days ignored from the addition. -(We cannot return Duration because it is subject to overflow or underflow.)

-

Example

-
-use chrono::{Duration, NaiveTime};
-
-let from_hms = NaiveTime::from_hms;
-
-assert_eq!(from_hms(3, 4, 5).overflowing_add_signed(Duration::hours(11)),
-           (from_hms(14, 4, 5), 0));
-assert_eq!(from_hms(3, 4, 5).overflowing_add_signed(Duration::hours(23)),
-           (from_hms(2, 4, 5), 86_400));
-assert_eq!(from_hms(3, 4, 5).overflowing_add_signed(Duration::hours(-7)),
-           (from_hms(20, 4, 5), -86_400));
-

pub fn overflowing_sub_signed(&self, rhs: OldDuration) -> (NaiveTime, i64)[src]

Subtracts given Duration from the current time, -and also returns the number of seconds -in the integral number of days ignored from the subtraction. -(We cannot return Duration because it is subject to overflow or underflow.)

-

Example

-
-use chrono::{Duration, NaiveTime};
-
-let from_hms = NaiveTime::from_hms;
-
-assert_eq!(from_hms(3, 4, 5).overflowing_sub_signed(Duration::hours(2)),
-           (from_hms(1, 4, 5), 0));
-assert_eq!(from_hms(3, 4, 5).overflowing_sub_signed(Duration::hours(17)),
-           (from_hms(10, 4, 5), 86_400));
-assert_eq!(from_hms(3, 4, 5).overflowing_sub_signed(Duration::hours(-22)),
-           (from_hms(1, 4, 5), -86_400));
-

pub fn signed_duration_since(self, rhs: NaiveTime) -> OldDuration[src]

Subtracts another NaiveTime from the current time. -Returns a Duration within +/- 1 day. -This does not overflow or underflow at all.

-

As a part of Chrono's leap second handling, -the subtraction assumes that there is no leap second ever, -except when any of the NaiveTimes themselves represents a leap second -in which case the assumption becomes that -there are exactly one (or two) leap second(s) ever.

-

Example

-
-use chrono::{Duration, NaiveTime};
-
-let from_hmsm = NaiveTime::from_hms_milli;
-let since = NaiveTime::signed_duration_since;
-
-assert_eq!(since(from_hmsm(3, 5, 7, 900), from_hmsm(3, 5, 7, 900)),
-           Duration::zero());
-assert_eq!(since(from_hmsm(3, 5, 7, 900), from_hmsm(3, 5, 7, 875)),
-           Duration::milliseconds(25));
-assert_eq!(since(from_hmsm(3, 5, 7, 900), from_hmsm(3, 5, 6, 925)),
-           Duration::milliseconds(975));
-assert_eq!(since(from_hmsm(3, 5, 7, 900), from_hmsm(3, 5, 0, 900)),
-           Duration::seconds(7));
-assert_eq!(since(from_hmsm(3, 5, 7, 900), from_hmsm(3, 0, 7, 900)),
-           Duration::seconds(5 * 60));
-assert_eq!(since(from_hmsm(3, 5, 7, 900), from_hmsm(0, 5, 7, 900)),
-           Duration::seconds(3 * 3600));
-assert_eq!(since(from_hmsm(3, 5, 7, 900), from_hmsm(4, 5, 7, 900)),
-           Duration::seconds(-3600));
-assert_eq!(since(from_hmsm(3, 5, 7, 900), from_hmsm(2, 4, 6, 800)),
-           Duration::seconds(3600 + 60 + 1) + Duration::milliseconds(100));
-

Leap seconds are handled, but the subtraction assumes that -there were no other leap seconds happened.

- -
-assert_eq!(since(from_hmsm(3, 0, 59, 1_000), from_hmsm(3, 0, 59, 0)),
-           Duration::seconds(1));
-assert_eq!(since(from_hmsm(3, 0, 59, 1_500), from_hmsm(3, 0, 59, 0)),
-           Duration::milliseconds(1500));
-assert_eq!(since(from_hmsm(3, 0, 59, 1_000), from_hmsm(3, 0, 0, 0)),
-           Duration::seconds(60));
-assert_eq!(since(from_hmsm(3, 0, 0, 0), from_hmsm(2, 59, 59, 1_000)),
-           Duration::seconds(1));
-assert_eq!(since(from_hmsm(3, 0, 59, 1_000), from_hmsm(2, 59, 59, 1_000)),
-           Duration::seconds(61));
-

pub fn format_with_items<'a, I, B>(&self, items: I) -> DelayedFormat<I> where
    I: Iterator<Item = B> + Clone,
    B: Borrow<Item<'a>>, 
[src]

Formats the time with the specified formatting items. -Otherwise it is the same as the ordinary format method.

-

The Iterator of items should be Cloneable, -since the resulting DelayedFormat value may be formatted multiple times.

-

Example

-
-use chrono::NaiveTime;
-use chrono::format::strftime::StrftimeItems;
-
-let fmt = StrftimeItems::new("%H:%M:%S");
-let t = NaiveTime::from_hms(23, 56, 4);
-assert_eq!(t.format_with_items(fmt.clone()).to_string(), "23:56:04");
-assert_eq!(t.format("%H:%M:%S").to_string(),             "23:56:04");
-

The resulting DelayedFormat can be formatted directly via the Display trait.

- -
-assert_eq!(format!("{}", t.format_with_items(fmt)), "23:56:04");
-

pub fn format<'a>(&self, fmt: &'a str) -> DelayedFormat<StrftimeItems<'a>>[src]

Formats the time with the specified format string. -See the format::strftime module -on the supported escape sequences.

-

This returns a DelayedFormat, -which gets converted to a string only when actual formatting happens. -You may use the to_string method to get a String, -or just feed it into print! and other formatting macros. -(In this way it avoids the redundant memory allocation.)

-

A wrong format string does not issue an error immediately. -Rather, converting or formatting the DelayedFormat fails. -You are recommended to immediately use DelayedFormat for this reason.

-

Example

-
-use chrono::NaiveTime;
-
-let t = NaiveTime::from_hms_nano(23, 56, 4, 12_345_678);
-assert_eq!(t.format("%H:%M:%S").to_string(), "23:56:04");
-assert_eq!(t.format("%H:%M:%S%.6f").to_string(), "23:56:04.012345");
-assert_eq!(t.format("%-I:%M %p").to_string(), "11:56 PM");
-

The resulting DelayedFormat can be formatted directly via the Display trait.

- -
-assert_eq!(format!("{}", t.format("%H:%M:%S")), "23:56:04");
-assert_eq!(format!("{}", t.format("%H:%M:%S%.6f")), "23:56:04.012345");
-assert_eq!(format!("{}", t.format("%-I:%M %p")), "11:56 PM");
-

Trait Implementations

impl Add<Duration> for NaiveTime[src]

An addition of Duration to NaiveTime wraps around and never overflows or underflows. -In particular the addition ignores integral number of days.

-

As a part of Chrono's leap second handling, -the addition assumes that there is no leap second ever, -except when the NaiveTime itself represents a leap second -in which case the assumption becomes that there is exactly a single leap second ever.

-

Example

-
-use chrono::{Duration, NaiveTime};
-
-let from_hmsm = NaiveTime::from_hms_milli;
-
-assert_eq!(from_hmsm(3, 5, 7, 0) + Duration::zero(),                  from_hmsm(3, 5, 7, 0));
-assert_eq!(from_hmsm(3, 5, 7, 0) + Duration::seconds(1),              from_hmsm(3, 5, 8, 0));
-assert_eq!(from_hmsm(3, 5, 7, 0) + Duration::seconds(-1),             from_hmsm(3, 5, 6, 0));
-assert_eq!(from_hmsm(3, 5, 7, 0) + Duration::seconds(60 + 4),         from_hmsm(3, 6, 11, 0));
-assert_eq!(from_hmsm(3, 5, 7, 0) + Duration::seconds(7*60*60 - 6*60), from_hmsm(9, 59, 7, 0));
-assert_eq!(from_hmsm(3, 5, 7, 0) + Duration::milliseconds(80),        from_hmsm(3, 5, 7, 80));
-assert_eq!(from_hmsm(3, 5, 7, 950) + Duration::milliseconds(280),     from_hmsm(3, 5, 8, 230));
-assert_eq!(from_hmsm(3, 5, 7, 950) + Duration::milliseconds(-980),    from_hmsm(3, 5, 6, 970));
-

The addition wraps around.

- -
-assert_eq!(from_hmsm(3, 5, 7, 0) + Duration::seconds(22*60*60), from_hmsm(1, 5, 7, 0));
-assert_eq!(from_hmsm(3, 5, 7, 0) + Duration::seconds(-8*60*60), from_hmsm(19, 5, 7, 0));
-assert_eq!(from_hmsm(3, 5, 7, 0) + Duration::days(800),         from_hmsm(3, 5, 7, 0));
-

Leap seconds are handled, but the addition assumes that it is the only leap second happened.

- -
-let leap = from_hmsm(3, 5, 59, 1_300);
-assert_eq!(leap + Duration::zero(),             from_hmsm(3, 5, 59, 1_300));
-assert_eq!(leap + Duration::milliseconds(-500), from_hmsm(3, 5, 59, 800));
-assert_eq!(leap + Duration::milliseconds(500),  from_hmsm(3, 5, 59, 1_800));
-assert_eq!(leap + Duration::milliseconds(800),  from_hmsm(3, 6, 0, 100));
-assert_eq!(leap + Duration::seconds(10),        from_hmsm(3, 6, 9, 300));
-assert_eq!(leap + Duration::seconds(-10),       from_hmsm(3, 5, 50, 300));
-assert_eq!(leap + Duration::days(1),            from_hmsm(3, 5, 59, 300));
-

type Output = NaiveTime

The resulting type after applying the + operator.

-

impl Add<FixedOffset> for NaiveTime[src]

type Output = NaiveTime

The resulting type after applying the + operator.

-

impl AddAssign<Duration> for NaiveTime[src]

impl Clone for NaiveTime[src]

impl Copy for NaiveTime[src]

impl Debug for NaiveTime[src]

The Debug output of the naive time t is the same as -t.format("%H:%M:%S%.f").

-

The string printed can be readily parsed via the parse method on str.

-

It should be noted that, for leap seconds not on the minute boundary, -it may print a representation not distinguishable from non-leap seconds. -This doesn't matter in practice, since such leap seconds never happened. -(By the time of the first leap second on 1972-06-30, -every time zone offset around the world has standardized to the 5-minute alignment.)

-

Example

-
-use chrono::NaiveTime;
-
-assert_eq!(format!("{:?}", NaiveTime::from_hms(23, 56, 4)),              "23:56:04");
-assert_eq!(format!("{:?}", NaiveTime::from_hms_milli(23, 56, 4, 12)),    "23:56:04.012");
-assert_eq!(format!("{:?}", NaiveTime::from_hms_micro(23, 56, 4, 1234)),  "23:56:04.001234");
-assert_eq!(format!("{:?}", NaiveTime::from_hms_nano(23, 56, 4, 123456)), "23:56:04.000123456");
-

Leap seconds may also be used.

- -
-assert_eq!(format!("{:?}", NaiveTime::from_hms_milli(6, 59, 59, 1_500)), "06:59:60.500");
-

impl Display for NaiveTime[src]

The Display output of the naive time t is the same as -t.format("%H:%M:%S%.f").

-

The string printed can be readily parsed via the parse method on str.

-

It should be noted that, for leap seconds not on the minute boundary, -it may print a representation not distinguishable from non-leap seconds. -This doesn't matter in practice, since such leap seconds never happened. -(By the time of the first leap second on 1972-06-30, -every time zone offset around the world has standardized to the 5-minute alignment.)

-

Example

-
-use chrono::NaiveTime;
-
-assert_eq!(format!("{}", NaiveTime::from_hms(23, 56, 4)),              "23:56:04");
-assert_eq!(format!("{}", NaiveTime::from_hms_milli(23, 56, 4, 12)),    "23:56:04.012");
-assert_eq!(format!("{}", NaiveTime::from_hms_micro(23, 56, 4, 1234)),  "23:56:04.001234");
-assert_eq!(format!("{}", NaiveTime::from_hms_nano(23, 56, 4, 123456)), "23:56:04.000123456");
-

Leap seconds may also be used.

- -
-assert_eq!(format!("{}", NaiveTime::from_hms_milli(6, 59, 59, 1_500)), "06:59:60.500");
-

impl Eq for NaiveTime[src]

impl FromStr for NaiveTime[src]

Parsing a str into a NaiveTime uses the same format, -%H:%M:%S%.f, as in Debug and Display.

-

Example

-
-use chrono::NaiveTime;
-
-let t = NaiveTime::from_hms(23, 56, 4);
-assert_eq!("23:56:04".parse::<NaiveTime>(), Ok(t));
-
-let t = NaiveTime::from_hms_nano(23, 56, 4, 12_345_678);
-assert_eq!("23:56:4.012345678".parse::<NaiveTime>(), Ok(t));
-
-let t = NaiveTime::from_hms_nano(23, 59, 59, 1_234_567_890); // leap second
-assert_eq!("23:59:60.23456789".parse::<NaiveTime>(), Ok(t));
-
-assert!("foo".parse::<NaiveTime>().is_err());
-

type Err = ParseError

The associated error which can be returned from parsing.

-

impl Hash for NaiveTime[src]

NaiveTime can be used as a key to the hash maps (in principle).

-

Practically this also takes account of fractional seconds, so it is not recommended. -(For the obvious reason this also distinguishes leap seconds from non-leap seconds.)

-

impl Ord for NaiveTime[src]

impl PartialEq<NaiveTime> for NaiveTime[src]

impl PartialOrd<NaiveTime> for NaiveTime[src]

impl StructuralEq for NaiveTime[src]

impl StructuralPartialEq for NaiveTime[src]

impl Sub<Duration> for NaiveTime[src]

A subtraction of Duration from NaiveTime wraps around and never overflows or underflows. -In particular the addition ignores integral number of days. -It is the same as the addition with a negated Duration.

-

As a part of Chrono's leap second handling, -the addition assumes that there is no leap second ever, -except when the NaiveTime itself represents a leap second -in which case the assumption becomes that there is exactly a single leap second ever.

-

Example

-
-use chrono::{Duration, NaiveTime};
-
-let from_hmsm = NaiveTime::from_hms_milli;
-
-assert_eq!(from_hmsm(3, 5, 7, 0) - Duration::zero(),                  from_hmsm(3, 5, 7, 0));
-assert_eq!(from_hmsm(3, 5, 7, 0) - Duration::seconds(1),              from_hmsm(3, 5, 6, 0));
-assert_eq!(from_hmsm(3, 5, 7, 0) - Duration::seconds(60 + 5),         from_hmsm(3, 4, 2, 0));
-assert_eq!(from_hmsm(3, 5, 7, 0) - Duration::seconds(2*60*60 + 6*60), from_hmsm(0, 59, 7, 0));
-assert_eq!(from_hmsm(3, 5, 7, 0) - Duration::milliseconds(80),        from_hmsm(3, 5, 6, 920));
-assert_eq!(from_hmsm(3, 5, 7, 950) - Duration::milliseconds(280),     from_hmsm(3, 5, 7, 670));
-

The subtraction wraps around.

- -
-assert_eq!(from_hmsm(3, 5, 7, 0) - Duration::seconds(8*60*60), from_hmsm(19, 5, 7, 0));
-assert_eq!(from_hmsm(3, 5, 7, 0) - Duration::days(800),        from_hmsm(3, 5, 7, 0));
-

Leap seconds are handled, but the subtraction assumes that it is the only leap second happened.

- -
-let leap = from_hmsm(3, 5, 59, 1_300);
-assert_eq!(leap - Duration::zero(),            from_hmsm(3, 5, 59, 1_300));
-assert_eq!(leap - Duration::milliseconds(200), from_hmsm(3, 5, 59, 1_100));
-assert_eq!(leap - Duration::milliseconds(500), from_hmsm(3, 5, 59, 800));
-assert_eq!(leap - Duration::seconds(60),       from_hmsm(3, 5, 0, 300));
-assert_eq!(leap - Duration::days(1),           from_hmsm(3, 6, 0, 300));
-

type Output = NaiveTime

The resulting type after applying the - operator.

-

impl Sub<FixedOffset> for NaiveTime[src]

type Output = NaiveTime

The resulting type after applying the - operator.

-

impl Sub<NaiveTime> for NaiveTime[src]

Subtracts another NaiveTime from the current time. -Returns a Duration within +/- 1 day. -This does not overflow or underflow at all.

-

As a part of Chrono's leap second handling, -the subtraction assumes that there is no leap second ever, -except when any of the NaiveTimes themselves represents a leap second -in which case the assumption becomes that -there are exactly one (or two) leap second(s) ever.

-

The implementation is a wrapper around -NaiveTime::signed_duration_since.

-

Example

-
-use chrono::{Duration, NaiveTime};
-
-let from_hmsm = NaiveTime::from_hms_milli;
-
-assert_eq!(from_hmsm(3, 5, 7, 900) - from_hmsm(3, 5, 7, 900), Duration::zero());
-assert_eq!(from_hmsm(3, 5, 7, 900) - from_hmsm(3, 5, 7, 875), Duration::milliseconds(25));
-assert_eq!(from_hmsm(3, 5, 7, 900) - from_hmsm(3, 5, 6, 925), Duration::milliseconds(975));
-assert_eq!(from_hmsm(3, 5, 7, 900) - from_hmsm(3, 5, 0, 900), Duration::seconds(7));
-assert_eq!(from_hmsm(3, 5, 7, 900) - from_hmsm(3, 0, 7, 900), Duration::seconds(5 * 60));
-assert_eq!(from_hmsm(3, 5, 7, 900) - from_hmsm(0, 5, 7, 900), Duration::seconds(3 * 3600));
-assert_eq!(from_hmsm(3, 5, 7, 900) - from_hmsm(4, 5, 7, 900), Duration::seconds(-3600));
-assert_eq!(from_hmsm(3, 5, 7, 900) - from_hmsm(2, 4, 6, 800),
-           Duration::seconds(3600 + 60 + 1) + Duration::milliseconds(100));
-

Leap seconds are handled, but the subtraction assumes that -there were no other leap seconds happened.

- -
-assert_eq!(from_hmsm(3, 0, 59, 1_000) - from_hmsm(3, 0, 59, 0), Duration::seconds(1));
-assert_eq!(from_hmsm(3, 0, 59, 1_500) - from_hmsm(3, 0, 59, 0),
-           Duration::milliseconds(1500));
-assert_eq!(from_hmsm(3, 0, 59, 1_000) - from_hmsm(3, 0, 0, 0), Duration::seconds(60));
-assert_eq!(from_hmsm(3, 0, 0, 0) - from_hmsm(2, 59, 59, 1_000), Duration::seconds(1));
-assert_eq!(from_hmsm(3, 0, 59, 1_000) - from_hmsm(2, 59, 59, 1_000),
-           Duration::seconds(61));
-

type Output = OldDuration

The resulting type after applying the - operator.

-

impl SubAssign<Duration> for NaiveTime[src]

impl Timelike for NaiveTime[src]

fn hour(&self) -> u32[src]

Returns the hour number from 0 to 23.

-

Example

-
-use chrono::{NaiveTime, Timelike};
-
-assert_eq!(NaiveTime::from_hms(0, 0, 0).hour(), 0);
-assert_eq!(NaiveTime::from_hms_nano(23, 56, 4, 12_345_678).hour(), 23);
-

fn minute(&self) -> u32[src]

Returns the minute number from 0 to 59.

-

Example

-
-use chrono::{NaiveTime, Timelike};
-
-assert_eq!(NaiveTime::from_hms(0, 0, 0).minute(), 0);
-assert_eq!(NaiveTime::from_hms_nano(23, 56, 4, 12_345_678).minute(), 56);
-

fn second(&self) -> u32[src]

Returns the second number from 0 to 59.

-

Example

-
-use chrono::{NaiveTime, Timelike};
-
-assert_eq!(NaiveTime::from_hms(0, 0, 0).second(), 0);
-assert_eq!(NaiveTime::from_hms_nano(23, 56, 4, 12_345_678).second(), 4);
-

This method never returns 60 even when it is a leap second. -(Why?) -Use the proper formatting method to get a human-readable representation.

- -
-let leap = NaiveTime::from_hms_milli(23, 59, 59, 1_000);
-assert_eq!(leap.second(), 59);
-assert_eq!(leap.format("%H:%M:%S").to_string(), "23:59:60");
-

fn nanosecond(&self) -> u32[src]

Returns the number of nanoseconds since the whole non-leap second. -The range from 1,000,000,000 to 1,999,999,999 represents -the leap second.

-

Example

-
-use chrono::{NaiveTime, Timelike};
-
-assert_eq!(NaiveTime::from_hms(0, 0, 0).nanosecond(), 0);
-assert_eq!(NaiveTime::from_hms_nano(23, 56, 4, 12_345_678).nanosecond(), 12_345_678);
-

Leap seconds may have seemingly out-of-range return values. -You can reduce the range with time.nanosecond() % 1_000_000_000, or -use the proper formatting method to get a human-readable representation.

- -
-let leap = NaiveTime::from_hms_milli(23, 59, 59, 1_000);
-assert_eq!(leap.nanosecond(), 1_000_000_000);
-assert_eq!(leap.format("%H:%M:%S%.9f").to_string(), "23:59:60.000000000");
-

fn with_hour(&self, hour: u32) -> Option<NaiveTime>[src]

Makes a new NaiveTime with the hour number changed.

-

Returns None when the resulting NaiveTime would be invalid.

-

Example

-
-use chrono::{NaiveTime, Timelike};
-
-let dt = NaiveTime::from_hms_nano(23, 56, 4, 12_345_678);
-assert_eq!(dt.with_hour(7), Some(NaiveTime::from_hms_nano(7, 56, 4, 12_345_678)));
-assert_eq!(dt.with_hour(24), None);
-

fn with_minute(&self, min: u32) -> Option<NaiveTime>[src]

Makes a new NaiveTime with the minute number changed.

-

Returns None when the resulting NaiveTime would be invalid.

-

Example

-
-use chrono::{NaiveTime, Timelike};
-
-let dt = NaiveTime::from_hms_nano(23, 56, 4, 12_345_678);
-assert_eq!(dt.with_minute(45), Some(NaiveTime::from_hms_nano(23, 45, 4, 12_345_678)));
-assert_eq!(dt.with_minute(60), None);
-

fn with_second(&self, sec: u32) -> Option<NaiveTime>[src]

Makes a new NaiveTime with the second number changed.

-

Returns None when the resulting NaiveTime would be invalid. -As with the second method, -the input range is restricted to 0 through 59.

-

Example

-
-use chrono::{NaiveTime, Timelike};
-
-let dt = NaiveTime::from_hms_nano(23, 56, 4, 12_345_678);
-assert_eq!(dt.with_second(17), Some(NaiveTime::from_hms_nano(23, 56, 17, 12_345_678)));
-assert_eq!(dt.with_second(60), None);
-

fn with_nanosecond(&self, nano: u32) -> Option<NaiveTime>[src]

Makes a new NaiveTime with nanoseconds since the whole non-leap second changed.

-

Returns None when the resulting NaiveTime would be invalid. -As with the nanosecond method, -the input range can exceed 1,000,000,000 for leap seconds.

-

Example

-
-use chrono::{NaiveTime, Timelike};
-
-let dt = NaiveTime::from_hms_nano(23, 56, 4, 12_345_678);
-assert_eq!(dt.with_nanosecond(333_333_333),
-           Some(NaiveTime::from_hms_nano(23, 56, 4, 333_333_333)));
-assert_eq!(dt.with_nanosecond(2_000_000_000), None);
-

Leap seconds can theoretically follow any whole second. -The following would be a proper leap second at the time zone offset of UTC-00:03:57 -(there are several historical examples comparable to this "non-sense" offset), -and therefore is allowed.

- -
-assert_eq!(dt.with_nanosecond(1_333_333_333),
-           Some(NaiveTime::from_hms_nano(23, 56, 4, 1_333_333_333)));
-

fn num_seconds_from_midnight(&self) -> u32[src]

Returns the number of non-leap seconds past the last midnight.

-

Example

-
-use chrono::{NaiveTime, Timelike};
-
-assert_eq!(NaiveTime::from_hms(1, 2, 3).num_seconds_from_midnight(),
-           3723);
-assert_eq!(NaiveTime::from_hms_nano(23, 56, 4, 12_345_678).num_seconds_from_midnight(),
-           86164);
-assert_eq!(NaiveTime::from_hms_milli(23, 59, 59, 1_000).num_seconds_from_midnight(),
-           86399);
-

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

-

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-
\ No newline at end of file diff --git a/docs/chrono/naive/time/struct.NaiveTime.html b/docs/chrono/naive/time/struct.NaiveTime.html deleted file mode 100644 index 96a3191f..00000000 --- a/docs/chrono/naive/time/struct.NaiveTime.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -

Redirecting to ../../../chrono/naive/struct.NaiveTime.html...

- - - \ No newline at end of file diff --git a/docs/chrono/offset/enum.LocalResult.html b/docs/chrono/offset/enum.LocalResult.html deleted file mode 100644 index f1d5770a..00000000 --- a/docs/chrono/offset/enum.LocalResult.html +++ /dev/null @@ -1,60 +0,0 @@ -chrono::offset::LocalResult - Rust - -

[][src]Enum chrono::offset::LocalResult

pub enum LocalResult<T> {
-    None,
-    Single(T),
-    Ambiguous(T, T),
-}

The conversion result from the local time to the timezone-aware datetime types.

-

- Variants

-
None

Given local time representation is invalid. -This can occur when, for example, the positive timezone transition.

-
Single(T)

Given local time representation has a single unique result.

-
Ambiguous(T, T)

Given local time representation has multiple results and thus ambiguous. -This can occur when, for example, the negative timezone transition.

-

Implementations

impl<T> LocalResult<T>[src]

pub fn single(self) -> Option<T>[src]

Returns Some only when the conversion result is unique, or None otherwise.

-

pub fn earliest(self) -> Option<T>[src]

Returns Some for the earliest possible conversion result, or None if none.

-

pub fn latest(self) -> Option<T>[src]

Returns Some for the latest possible conversion result, or None if none.

-

pub fn map<U, F: FnMut(T) -> U>(self, f: F) -> LocalResult<U>[src]

Maps a LocalResult<T> into LocalResult<U> with given function.

-

impl<Tz: TimeZone> LocalResult<Date<Tz>>[src]

pub fn and_time(self, time: NaiveTime) -> LocalResult<DateTime<Tz>>[src]

Makes a new DateTime from the current date and given NaiveTime. -The offset in the current date is preserved.

-

Propagates any error. Ambiguous result would be discarded.

-

pub fn and_hms_opt(
    self,
    hour: u32,
    min: u32,
    sec: u32
) -> LocalResult<DateTime<Tz>>
[src]

Makes a new DateTime from the current date, hour, minute and second. -The offset in the current date is preserved.

-

Propagates any error. Ambiguous result would be discarded.

-

pub fn and_hms_milli_opt(
    self,
    hour: u32,
    min: u32,
    sec: u32,
    milli: u32
) -> LocalResult<DateTime<Tz>>
[src]

Makes a new DateTime from the current date, hour, minute, second and millisecond. -The millisecond part can exceed 1,000 in order to represent the leap second. -The offset in the current date is preserved.

-

Propagates any error. Ambiguous result would be discarded.

-

pub fn and_hms_micro_opt(
    self,
    hour: u32,
    min: u32,
    sec: u32,
    micro: u32
) -> LocalResult<DateTime<Tz>>
[src]

Makes a new DateTime from the current date, hour, minute, second and microsecond. -The microsecond part can exceed 1,000,000 in order to represent the leap second. -The offset in the current date is preserved.

-

Propagates any error. Ambiguous result would be discarded.

-

pub fn and_hms_nano_opt(
    self,
    hour: u32,
    min: u32,
    sec: u32,
    nano: u32
) -> LocalResult<DateTime<Tz>>
[src]

Makes a new DateTime from the current date, hour, minute, second and nanosecond. -The nanosecond part can exceed 1,000,000,000 in order to represent the leap second. -The offset in the current date is preserved.

-

Propagates any error. Ambiguous result would be discarded.

-

impl<T: Debug> LocalResult<T>[src]

pub fn unwrap(self) -> T[src]

Returns the single unique conversion result, or panics accordingly.

-

Trait Implementations

impl<T: Clone> Clone for LocalResult<T>[src]

impl<T: Copy> Copy for LocalResult<T>[src]

impl<T: Debug> Debug for LocalResult<T>[src]

impl<T: Eq> Eq for LocalResult<T>[src]

impl<T: Hash> Hash for LocalResult<T>[src]

impl<T: PartialEq> PartialEq<LocalResult<T>> for LocalResult<T>[src]

impl<T> StructuralEq for LocalResult<T>[src]

impl<T> StructuralPartialEq for LocalResult<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for LocalResult<T> where
    T: RefUnwindSafe
[src]

impl<T> Send for LocalResult<T> where
    T: Send
[src]

impl<T> Sync for LocalResult<T> where
    T: Sync
[src]

impl<T> Unpin for LocalResult<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for LocalResult<T> where
    T: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

-

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-
\ No newline at end of file diff --git a/docs/chrono/offset/fixed/struct.FixedOffset.html b/docs/chrono/offset/fixed/struct.FixedOffset.html deleted file mode 100644 index b4f5f7d5..00000000 --- a/docs/chrono/offset/fixed/struct.FixedOffset.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -

Redirecting to ../../../chrono/offset/struct.FixedOffset.html...

- - - \ No newline at end of file diff --git a/docs/chrono/offset/index.html b/docs/chrono/offset/index.html deleted file mode 100644 index cfed349f..00000000 --- a/docs/chrono/offset/index.html +++ /dev/null @@ -1,29 +0,0 @@ -chrono::offset - Rust - -

[][src]Module chrono::offset

The time zone, which calculates offsets from the local time to UTC.

-

There are four operations provided by the TimeZone trait:

-
    -
  1. Converting the local NaiveDateTime to DateTime<Tz>
  2. -
  3. Converting the UTC NaiveDateTime to DateTime<Tz>
  4. -
  5. Converting DateTime<Tz> to the local NaiveDateTime
  6. -
  7. Constructing DateTime<Tz> objects from various offsets
  8. -
-

1 is used for constructors. 2 is used for the with_timezone method of date and time types. -3 is used for other methods, e.g. year() or format(), and provided by an associated type -which implements Offset (which then passed to TimeZone for actual implementations). -Technically speaking TimeZone has a total knowledge about given timescale, -but Offset is used as a cache to avoid the repeated conversion -and provides implementations for 1 and 3. -An TimeZone instance can be reconstructed from the corresponding Offset instance.

-

Structs

-
FixedOffset

The time zone with fixed offset, from UTC-23:59:59 to UTC+23:59:59.

-
Local

The local timescale. This is implemented via the standard time crate.

-
Utc

The UTC time zone. This is the most efficient time zone when you don't need the local time. -It is also used as an offset (which is also a dummy type).

-

Enums

-
LocalResult

The conversion result from the local time to the timezone-aware datetime types.

-

Traits

-
Offset

The offset from the local time to UTC.

-
TimeZone

The time zone.

-
\ No newline at end of file diff --git a/docs/chrono/offset/local/struct.Local.html b/docs/chrono/offset/local/struct.Local.html deleted file mode 100644 index 929d8133..00000000 --- a/docs/chrono/offset/local/struct.Local.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -

Redirecting to ../../../chrono/offset/struct.Local.html...

- - - \ No newline at end of file diff --git a/docs/chrono/offset/sidebar-items.js b/docs/chrono/offset/sidebar-items.js deleted file mode 100644 index 6e689563..00000000 --- a/docs/chrono/offset/sidebar-items.js +++ /dev/null @@ -1 +0,0 @@ -initSidebarItems({"enum":[["LocalResult","The conversion result from the local time to the timezone-aware datetime types."]],"struct":[["FixedOffset","The time zone with fixed offset, from UTC-23:59:59 to UTC+23:59:59."],["Local","The local timescale. This is implemented via the standard `time` crate."],["Utc","The UTC time zone. This is the most efficient time zone when you don't need the local time. It is also used as an offset (which is also a dummy type)."]],"trait":[["Offset","The offset from the local time to UTC."],["TimeZone","The time zone."]]}); \ No newline at end of file diff --git a/docs/chrono/offset/struct.FixedOffset.html b/docs/chrono/offset/struct.FixedOffset.html deleted file mode 100644 index 3fbb65f4..00000000 --- a/docs/chrono/offset/struct.FixedOffset.html +++ /dev/null @@ -1,119 +0,0 @@ -chrono::offset::FixedOffset - Rust - -

[][src]Struct chrono::offset::FixedOffset

pub struct FixedOffset { /* fields omitted */ }

The time zone with fixed offset, from UTC-23:59:59 to UTC+23:59:59.

-

Using the TimeZone methods -on a FixedOffset struct is the preferred way to construct -DateTime<FixedOffset> instances. See the east and -west methods for examples.

-

Implementations

impl FixedOffset[src]

pub fn east(secs: i32) -> FixedOffset[src]

Makes a new FixedOffset for the Eastern Hemisphere with given timezone difference. -The negative secs means the Western Hemisphere.

-

Panics on the out-of-bound secs.

-

Example

-
-use chrono::{FixedOffset, TimeZone};
-let hour = 3600;
-let datetime = FixedOffset::east(5 * hour).ymd(2016, 11, 08)
-                                          .and_hms(0, 0, 0);
-assert_eq!(&datetime.to_rfc3339(), "2016-11-08T00:00:00+05:00")
-

pub fn east_opt(secs: i32) -> Option<FixedOffset>[src]

Makes a new FixedOffset for the Eastern Hemisphere with given timezone difference. -The negative secs means the Western Hemisphere.

-

Returns None on the out-of-bound secs.

-

pub fn west(secs: i32) -> FixedOffset[src]

Makes a new FixedOffset for the Western Hemisphere with given timezone difference. -The negative secs means the Eastern Hemisphere.

-

Panics on the out-of-bound secs.

-

Example

-
-use chrono::{FixedOffset, TimeZone};
-let hour = 3600;
-let datetime = FixedOffset::west(5 * hour).ymd(2016, 11, 08)
-                                          .and_hms(0, 0, 0);
-assert_eq!(&datetime.to_rfc3339(), "2016-11-08T00:00:00-05:00")
-

pub fn west_opt(secs: i32) -> Option<FixedOffset>[src]

Makes a new FixedOffset for the Western Hemisphere with given timezone difference. -The negative secs means the Eastern Hemisphere.

-

Returns None on the out-of-bound secs.

-

pub fn local_minus_utc(&self) -> i32[src]

Returns the number of seconds to add to convert from UTC to the local time.

-

pub fn utc_minus_local(&self) -> i32[src]

Returns the number of seconds to add to convert from the local time to UTC.

-

Trait Implementations

impl Add<FixedOffset> for NaiveTime[src]

type Output = NaiveTime

The resulting type after applying the + operator.

-

impl Add<FixedOffset> for NaiveDateTime[src]

type Output = NaiveDateTime

The resulting type after applying the + operator.

-

impl<Tz: TimeZone> Add<FixedOffset> for DateTime<Tz>[src]

type Output = DateTime<Tz>

The resulting type after applying the + operator.

-

impl Clone for FixedOffset[src]

impl Copy for FixedOffset[src]

impl Debug for FixedOffset[src]

impl Display for FixedOffset[src]

impl Eq for FixedOffset[src]

impl Hash for FixedOffset[src]

impl Offset for FixedOffset[src]

impl PartialEq<FixedOffset> for FixedOffset[src]

impl StructuralEq for FixedOffset[src]

impl StructuralPartialEq for FixedOffset[src]

impl Sub<FixedOffset> for NaiveTime[src]

type Output = NaiveTime

The resulting type after applying the - operator.

-

impl Sub<FixedOffset> for NaiveDateTime[src]

type Output = NaiveDateTime

The resulting type after applying the - operator.

-

impl<Tz: TimeZone> Sub<FixedOffset> for DateTime<Tz>[src]

type Output = DateTime<Tz>

The resulting type after applying the - operator.

-

impl TimeZone for FixedOffset[src]

type Offset = FixedOffset

An associated offset type. -This type is used to store the actual offset in date and time types. -The original TimeZone value can be recovered via TimeZone::from_offset. Read more

-

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

-

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-
\ No newline at end of file diff --git a/docs/chrono/offset/struct.Local.html b/docs/chrono/offset/struct.Local.html deleted file mode 100644 index 8d19e77b..00000000 --- a/docs/chrono/offset/struct.Local.html +++ /dev/null @@ -1,78 +0,0 @@ -chrono::offset::Local - Rust - -

[][src]Struct chrono::offset::Local

pub struct Local;

The local timescale. This is implemented via the standard time crate.

-

Using the TimeZone methods -on the Local struct is the preferred way to construct DateTime<Local> -instances.

-

Example

-
-use chrono::{Local, DateTime, TimeZone};
-
-let dt: DateTime<Local> = Local::now();
-let dt: DateTime<Local> = Local.timestamp(0, 0);
-

Implementations

impl Local[src]

pub fn today() -> Date<Local>[src]

Returns a Date which corresponds to the current date.

-

pub fn now() -> DateTime<Local>[src]

Returns a DateTime which corresponds to the current date.

-

Trait Implementations

impl Clone for Local[src]

impl Copy for Local[src]

impl Debug for Local[src]

impl TimeZone for Local[src]

type Offset = FixedOffset

An associated offset type. -This type is used to store the actual offset in date and time types. -The original TimeZone value can be recovered via TimeZone::from_offset. Read more

-

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

-

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-
\ No newline at end of file diff --git a/docs/chrono/offset/struct.Utc.html b/docs/chrono/offset/struct.Utc.html deleted file mode 100644 index b47395c7..00000000 --- a/docs/chrono/offset/struct.Utc.html +++ /dev/null @@ -1,87 +0,0 @@ -chrono::offset::Utc - Rust - -

[][src]Struct chrono::offset::Utc

pub struct Utc;

The UTC time zone. This is the most efficient time zone when you don't need the local time. -It is also used as an offset (which is also a dummy type).

-

Using the TimeZone methods -on the UTC struct is the preferred way to construct DateTime<Utc> -instances.

-

Example

-
-use chrono::{DateTime, TimeZone, NaiveDateTime, Utc};
-
-let dt = DateTime::<Utc>::from_utc(NaiveDateTime::from_timestamp(61, 0), Utc);
-
-assert_eq!(Utc.timestamp(61, 0), dt);
-assert_eq!(Utc.ymd(1970, 1, 1).and_hms(0, 1, 1), dt);
-

Implementations

impl Utc[src]

pub fn today() -> Date<Utc>[src]

Returns a Date which corresponds to the current date.

-

pub fn now() -> DateTime<Utc>[src]

Returns a DateTime which corresponds to the current date.

-

Trait Implementations

impl Clone for Utc[src]

impl Copy for Utc[src]

impl Debug for Utc[src]

impl Display for Utc[src]

impl Eq for Utc[src]

impl Offset for Utc[src]

impl PartialEq<Utc> for Utc[src]

impl StructuralEq for Utc[src]

impl StructuralPartialEq for Utc[src]

impl TimeZone for Utc[src]

type Offset = Utc

An associated offset type. -This type is used to store the actual offset in date and time types. -The original TimeZone value can be recovered via TimeZone::from_offset. Read more

-

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

-

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-
\ No newline at end of file diff --git a/docs/chrono/offset/trait.Offset.html b/docs/chrono/offset/trait.Offset.html deleted file mode 100644 index bb3c023f..00000000 --- a/docs/chrono/offset/trait.Offset.html +++ /dev/null @@ -1,8 +0,0 @@ -chrono::offset::Offset - Rust - -

[][src]Trait chrono::offset::Offset

pub trait Offset: Sized + Clone + Debug {
-    fn fix(&self) -> FixedOffset;
-}

The offset from the local time to UTC.

-

Required methods

fn fix(&self) -> FixedOffset[src]

Returns the fixed offset from UTC to the local time stored.

-
Loading content...

Implementors

impl Offset for FixedOffset[src]

impl Offset for Utc[src]

Loading content...
\ No newline at end of file diff --git a/docs/chrono/offset/trait.TimeZone.html b/docs/chrono/offset/trait.TimeZone.html deleted file mode 100644 index 10b73bdc..00000000 --- a/docs/chrono/offset/trait.TimeZone.html +++ /dev/null @@ -1,153 +0,0 @@ -chrono::offset::TimeZone - Rust - -

[][src]Trait chrono::offset::TimeZone

pub trait TimeZone: Sized + Clone {
-    type Offset: Offset;
-    fn from_offset(offset: &Self::Offset) -> Self;
-
fn offset_from_local_date(
        &self,
        local: &NaiveDate
    ) -> LocalResult<Self::Offset>; -
fn offset_from_local_datetime(
        &self,
        local: &NaiveDateTime
    ) -> LocalResult<Self::Offset>; -
fn offset_from_utc_date(&self, utc: &NaiveDate) -> Self::Offset; -
fn offset_from_utc_datetime(&self, utc: &NaiveDateTime) -> Self::Offset; - - fn ymd(&self, year: i32, month: u32, day: u32) -> Date<Self> { ... } -
fn ymd_opt(
        &self,
        year: i32,
        month: u32,
        day: u32
    ) -> LocalResult<Date<Self>> { ... } -
fn yo(&self, year: i32, ordinal: u32) -> Date<Self> { ... } -
fn yo_opt(&self, year: i32, ordinal: u32) -> LocalResult<Date<Self>> { ... } -
fn isoywd(&self, year: i32, week: u32, weekday: Weekday) -> Date<Self> { ... } -
fn isoywd_opt(
        &self,
        year: i32,
        week: u32,
        weekday: Weekday
    ) -> LocalResult<Date<Self>> { ... } -
fn timestamp(&self, secs: i64, nsecs: u32) -> DateTime<Self> { ... } -
fn timestamp_opt(
        &self,
        secs: i64,
        nsecs: u32
    ) -> LocalResult<DateTime<Self>> { ... } -
fn timestamp_millis(&self, millis: i64) -> DateTime<Self> { ... } -
fn timestamp_millis_opt(&self, millis: i64) -> LocalResult<DateTime<Self>> { ... } -
fn timestamp_nanos(&self, nanos: i64) -> DateTime<Self> { ... } -
fn datetime_from_str(
        &self,
        s: &str,
        fmt: &str
    ) -> ParseResult<DateTime<Self>> { ... } -
fn from_local_date(&self, local: &NaiveDate) -> LocalResult<Date<Self>> { ... } -
fn from_local_datetime(
        &self,
        local: &NaiveDateTime
    ) -> LocalResult<DateTime<Self>> { ... } -
fn from_utc_date(&self, utc: &NaiveDate) -> Date<Self> { ... } -
fn from_utc_datetime(&self, utc: &NaiveDateTime) -> DateTime<Self> { ... } -}

The time zone.

-

The methods here are the primarily constructors for Date and -DateTime types.

-

Associated Types

type Offset: Offset[src]

An associated offset type. -This type is used to store the actual offset in date and time types. -The original TimeZone value can be recovered via TimeZone::from_offset.

-
Loading content...

Required methods

fn from_offset(offset: &Self::Offset) -> Self[src]

Reconstructs the time zone from the offset.

-

fn offset_from_local_date(&self, local: &NaiveDate) -> LocalResult<Self::Offset>[src]

Creates the offset(s) for given local NaiveDate if possible.

-

fn offset_from_local_datetime(
    &self,
    local: &NaiveDateTime
) -> LocalResult<Self::Offset>
[src]

Creates the offset(s) for given local NaiveDateTime if possible.

-

fn offset_from_utc_date(&self, utc: &NaiveDate) -> Self::Offset[src]

Creates the offset for given UTC NaiveDate. This cannot fail.

-

fn offset_from_utc_datetime(&self, utc: &NaiveDateTime) -> Self::Offset[src]

Creates the offset for given UTC NaiveDateTime. This cannot fail.

-
Loading content...

Provided methods

fn ymd(&self, year: i32, month: u32, day: u32) -> Date<Self>[src]

Makes a new Date from year, month, day and the current time zone. -This assumes the proleptic Gregorian calendar, with the year 0 being 1 BCE.

-

The time zone normally does not affect the date (unless it is between UTC-24 and UTC+24), -but it will propagate to the DateTime values constructed via this date.

-

Panics on the out-of-range date, invalid month and/or day.

-

Example

-
-use chrono::{Utc, TimeZone};
-
-assert_eq!(Utc.ymd(2015, 5, 15).to_string(), "2015-05-15UTC");
-

fn ymd_opt(&self, year: i32, month: u32, day: u32) -> LocalResult<Date<Self>>[src]

Makes a new Date from year, month, day and the current time zone. -This assumes the proleptic Gregorian calendar, with the year 0 being 1 BCE.

-

The time zone normally does not affect the date (unless it is between UTC-24 and UTC+24), -but it will propagate to the DateTime values constructed via this date.

-

Returns None on the out-of-range date, invalid month and/or day.

-

Example

-
-use chrono::{Utc, LocalResult, TimeZone};
-
-assert_eq!(Utc.ymd_opt(2015, 5, 15).unwrap().to_string(), "2015-05-15UTC");
-assert_eq!(Utc.ymd_opt(2000, 0, 0), LocalResult::None);
-

fn yo(&self, year: i32, ordinal: u32) -> Date<Self>[src]

Makes a new Date from year, day of year (DOY or "ordinal") and the current time zone. -This assumes the proleptic Gregorian calendar, with the year 0 being 1 BCE.

-

The time zone normally does not affect the date (unless it is between UTC-24 and UTC+24), -but it will propagate to the DateTime values constructed via this date.

-

Panics on the out-of-range date and/or invalid DOY.

-

Example

-
-use chrono::{Utc, TimeZone};
-
-assert_eq!(Utc.yo(2015, 135).to_string(), "2015-05-15UTC");
-

fn yo_opt(&self, year: i32, ordinal: u32) -> LocalResult<Date<Self>>[src]

Makes a new Date from year, day of year (DOY or "ordinal") and the current time zone. -This assumes the proleptic Gregorian calendar, with the year 0 being 1 BCE.

-

The time zone normally does not affect the date (unless it is between UTC-24 and UTC+24), -but it will propagate to the DateTime values constructed via this date.

-

Returns None on the out-of-range date and/or invalid DOY.

-

fn isoywd(&self, year: i32, week: u32, weekday: Weekday) -> Date<Self>[src]

Makes a new Date from ISO week date (year and week number), day of the week (DOW) and -the current time zone. -This assumes the proleptic Gregorian calendar, with the year 0 being 1 BCE. -The resulting Date may have a different year from the input year.

-

The time zone normally does not affect the date (unless it is between UTC-24 and UTC+24), -but it will propagate to the DateTime values constructed via this date.

-

Panics on the out-of-range date and/or invalid week number.

-

Example

-
-use chrono::{Utc, Weekday, TimeZone};
-
-assert_eq!(Utc.isoywd(2015, 20, Weekday::Fri).to_string(), "2015-05-15UTC");
-

fn isoywd_opt(
    &self,
    year: i32,
    week: u32,
    weekday: Weekday
) -> LocalResult<Date<Self>>
[src]

Makes a new Date from ISO week date (year and week number), day of the week (DOW) and -the current time zone. -This assumes the proleptic Gregorian calendar, with the year 0 being 1 BCE. -The resulting Date may have a different year from the input year.

-

The time zone normally does not affect the date (unless it is between UTC-24 and UTC+24), -but it will propagate to the DateTime values constructed via this date.

-

Returns None on the out-of-range date and/or invalid week number.

-

fn timestamp(&self, secs: i64, nsecs: u32) -> DateTime<Self>[src]

Makes a new DateTime from the number of non-leap seconds -since January 1, 1970 0:00:00 UTC (aka "UNIX timestamp") -and the number of nanoseconds since the last whole non-leap second.

-

Panics on the out-of-range number of seconds and/or invalid nanosecond, -for a non-panicking version see timestamp_opt.

-

Example

-
-use chrono::{Utc, TimeZone};
-
-assert_eq!(Utc.timestamp(1431648000, 0).to_string(), "2015-05-15 00:00:00 UTC");
-

fn timestamp_opt(&self, secs: i64, nsecs: u32) -> LocalResult<DateTime<Self>>[src]

Makes a new DateTime from the number of non-leap seconds -since January 1, 1970 0:00:00 UTC (aka "UNIX timestamp") -and the number of nanoseconds since the last whole non-leap second.

-

Returns LocalResult::None on out-of-range number of seconds and/or -invalid nanosecond, otherwise always returns LocalResult::Single.

-

fn timestamp_millis(&self, millis: i64) -> DateTime<Self>[src]

Makes a new DateTime from the number of non-leap milliseconds -since January 1, 1970 0:00:00 UTC (aka "UNIX timestamp").

-

Panics on out-of-range number of milliseconds for a non-panicking -version see timestamp_millis_opt.

-

Example

-
-use chrono::{Utc, TimeZone};
-
-assert_eq!(Utc.timestamp_millis(1431648000).timestamp(), 1431648);
-

fn timestamp_millis_opt(&self, millis: i64) -> LocalResult<DateTime<Self>>[src]

Makes a new DateTime from the number of non-leap milliseconds -since January 1, 1970 0:00:00 UTC (aka "UNIX timestamp").

-

Returns LocalResult::None on out-of-range number of milliseconds -and/or invalid nanosecond, otherwise always returns -LocalResult::Single.

-

Example

-
-use chrono::{Utc, TimeZone, LocalResult};
-match Utc.timestamp_millis_opt(1431648000) {
-    LocalResult::Single(dt) => assert_eq!(dt.timestamp(), 1431648),
-    _ => panic!("Incorrect timestamp_millis"),
-};
-

fn timestamp_nanos(&self, nanos: i64) -> DateTime<Self>[src]

Makes a new DateTime from the number of non-leap nanoseconds -since January 1, 1970 0:00:00 UTC (aka "UNIX timestamp").

-

Unlike timestamp_millis, this never -panics.

-

Example

-
-use chrono::{Utc, TimeZone};
-
-assert_eq!(Utc.timestamp_nanos(1431648000000000).timestamp(), 1431648);
-

fn datetime_from_str(&self, s: &str, fmt: &str) -> ParseResult<DateTime<Self>>[src]

Parses a string with the specified format string and -returns a DateTime with the current offset. -See the format::strftime module -on the supported escape sequences.

-

If the format does not include offsets, the current offset is assumed; -otherwise the input should have a matching UTC offset.

-

See also DateTime::parse_from_str which gives a local DateTime -with parsed FixedOffset.

-

fn from_local_date(&self, local: &NaiveDate) -> LocalResult<Date<Self>>[src]

Converts the local NaiveDate to the timezone-aware Date if possible.

-

fn from_local_datetime(
    &self,
    local: &NaiveDateTime
) -> LocalResult<DateTime<Self>>
[src]

Converts the local NaiveDateTime to the timezone-aware DateTime if possible.

-

fn from_utc_date(&self, utc: &NaiveDate) -> Date<Self>[src]

Converts the UTC NaiveDate to the local time. -The UTC is continuous and thus this cannot fail (but can give the duplicate local time).

-

fn from_utc_datetime(&self, utc: &NaiveDateTime) -> DateTime<Self>[src]

Converts the UTC NaiveDateTime to the local time. -The UTC is continuous and thus this cannot fail (but can give the duplicate local time).

-
Loading content...

Implementors

impl TimeZone for FixedOffset[src]

impl TimeZone for Local[src]

impl TimeZone for Utc[src]

Loading content...
\ No newline at end of file diff --git a/docs/chrono/offset/utc/struct.Utc.html b/docs/chrono/offset/utc/struct.Utc.html deleted file mode 100644 index 85d092cb..00000000 --- a/docs/chrono/offset/utc/struct.Utc.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -

Redirecting to ../../../chrono/offset/struct.Utc.html...

- - - \ No newline at end of file diff --git a/docs/chrono/prelude/index.html b/docs/chrono/prelude/index.html deleted file mode 100644 index 49e036a9..00000000 --- a/docs/chrono/prelude/index.html +++ /dev/null @@ -1,6 +0,0 @@ -chrono::prelude - Rust - -

[][src]Module chrono::prelude

A convenience module appropriate for glob imports (use chrono::prelude::*;).

-

Re-exports

-
pub use Date;
pub use Local;
pub use SubsecRound;
pub use DateTime;
pub use SecondsFormat;
pub use Datelike;
pub use Month;
pub use Timelike;
pub use Weekday;
pub use FixedOffset;
pub use Utc;
pub use NaiveDate;
pub use NaiveDateTime;
pub use NaiveTime;
pub use Offset;
pub use TimeZone;
\ No newline at end of file diff --git a/docs/chrono/prelude/sidebar-items.js b/docs/chrono/prelude/sidebar-items.js deleted file mode 100644 index 48333d31..00000000 --- a/docs/chrono/prelude/sidebar-items.js +++ /dev/null @@ -1 +0,0 @@ -initSidebarItems({}); \ No newline at end of file diff --git a/docs/chrono/round/enum.RoundingError.html b/docs/chrono/round/enum.RoundingError.html deleted file mode 100644 index f3df6ce9..00000000 --- a/docs/chrono/round/enum.RoundingError.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -

Redirecting to ../../chrono/enum.RoundingError.html...

- - - \ No newline at end of file diff --git a/docs/chrono/round/trait.DurationRound.html b/docs/chrono/round/trait.DurationRound.html deleted file mode 100644 index 43581e44..00000000 --- a/docs/chrono/round/trait.DurationRound.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -

Redirecting to ../../chrono/trait.DurationRound.html...

- - - \ No newline at end of file diff --git a/docs/chrono/round/trait.SubsecRound.html b/docs/chrono/round/trait.SubsecRound.html deleted file mode 100644 index 643966d0..00000000 --- a/docs/chrono/round/trait.SubsecRound.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -

Redirecting to ../../chrono/trait.SubsecRound.html...

- - - \ No newline at end of file diff --git a/docs/chrono/sidebar-items.js b/docs/chrono/sidebar-items.js deleted file mode 100644 index db0c5512..00000000 --- a/docs/chrono/sidebar-items.js +++ /dev/null @@ -1 +0,0 @@ -initSidebarItems({"constant":[["MAX_DATE","The maximum possible `Date`."],["MAX_DATETIME","The maximum possible `DateTime`."],["MIN_DATE","The minimum possible `Date`."],["MIN_DATETIME","The minimum possible `DateTime`."]],"enum":[["Month","The month of the year."],["RoundingError","An error from rounding by `Duration`"],["SecondsFormat","Specific formatting options for seconds. This may be extended in the future, so exhaustive matching in external code is not recommended."],["Weekday","The day of week."]],"mod":[["format","Formatting (and parsing) utilities for date and time."],["naive","Date and time types unconcerned with timezones."],["offset","The time zone, which calculates offsets from the local time to UTC."],["prelude","A convenience module appropriate for glob imports (`use chrono::prelude::*;`)."]],"struct":[["Date","ISO 8601 calendar date with time zone."],["DateTime","ISO 8601 combined date and time with time zone."],["Duration","ISO 8601 time duration with nanosecond precision. This also allows for the negative duration; see individual methods for details."],["ParseMonthError","An error resulting from reading `` value with `FromStr`."],["ParseWeekdayError","An error resulting from reading `Weekday` value with `FromStr`."]],"trait":[["Datelike","The common set of methods for date component."],["DurationRound","Extension trait for rounding or truncating a DateTime by a Duration."],["SubsecRound","Extension trait for subsecond rounding or truncation to a maximum number of digits. Rounding can be used to decrease the error variance when serializing/persisting to lower precision. Truncation is the default behavior in Chrono display formatting. Either can be used to guarantee equality (e.g. for testing) when round-tripping through a lower precision format."],["Timelike","The common set of methods for time component."]]}); \ No newline at end of file diff --git a/docs/chrono/struct.Date.html b/docs/chrono/struct.Date.html deleted file mode 100644 index bb220706..00000000 --- a/docs/chrono/struct.Date.html +++ /dev/null @@ -1,156 +0,0 @@ -chrono::Date - Rust - -

[][src]Struct chrono::Date

pub struct Date<Tz: TimeZone> { /* fields omitted */ }

ISO 8601 calendar date with time zone.

-

This type should be considered ambiguous at best, -due to the inherent lack of precision required for the time zone resolution. -For serialization and deserialization uses, it is best to use NaiveDate instead. -There are some guarantees on the usage of Date<Tz>:

-
    -
  • -

    If properly constructed via TimeZone::ymd and others without an error, -the corresponding local date should exist for at least a moment. -(It may still have a gap from the offset changes.)

    -
  • -
  • -

    The TimeZone is free to assign any Offset to the local date, -as long as that offset did occur in given day. -For example, if 2015-03-08T01:59-08:00 is followed by 2015-03-08T03:00-07:00, -it may produce either 2015-03-08-08:00 or 2015-03-08-07:00 -but not 2015-03-08+00:00 and others.

    -
  • -
  • -

    Once constructed as a full DateTime, -DateTime::date and other associated methods should return those for the original Date. -For example, if dt = tz.ymd(y,m,d).hms(h,n,s) were valid, dt.date() == tz.ymd(y,m,d).

    -
  • -
  • -

    The date is timezone-agnostic up to one day (i.e. practically always), -so the local date and UTC date should be equal for most cases -even though the raw calculation between NaiveDate and Duration may not.

    -
  • -
-

Implementations

impl<Tz: TimeZone> Date<Tz>[src]

pub fn from_utc(date: NaiveDate, offset: Tz::Offset) -> Date<Tz>[src]

Makes a new Date with given UTC date and offset. -The local date should be constructed via the TimeZone trait.

-

pub fn and_time(&self, time: NaiveTime) -> Option<DateTime<Tz>>[src]

Makes a new DateTime from the current date and given NaiveTime. -The offset in the current date is preserved.

-

Panics on invalid datetime.

-

pub fn and_hms(&self, hour: u32, min: u32, sec: u32) -> DateTime<Tz>[src]

Makes a new DateTime from the current date, hour, minute and second. -The offset in the current date is preserved.

-

Panics on invalid hour, minute and/or second.

-

pub fn and_hms_opt(&self, hour: u32, min: u32, sec: u32) -> Option<DateTime<Tz>>[src]

Makes a new DateTime from the current date, hour, minute and second. -The offset in the current date is preserved.

-

Returns None on invalid hour, minute and/or second.

-

pub fn and_hms_milli(
    &self,
    hour: u32,
    min: u32,
    sec: u32,
    milli: u32
) -> DateTime<Tz>
[src]

Makes a new DateTime from the current date, hour, minute, second and millisecond. -The millisecond part can exceed 1,000 in order to represent the leap second. -The offset in the current date is preserved.

-

Panics on invalid hour, minute, second and/or millisecond.

-

pub fn and_hms_milli_opt(
    &self,
    hour: u32,
    min: u32,
    sec: u32,
    milli: u32
) -> Option<DateTime<Tz>>
[src]

Makes a new DateTime from the current date, hour, minute, second and millisecond. -The millisecond part can exceed 1,000 in order to represent the leap second. -The offset in the current date is preserved.

-

Returns None on invalid hour, minute, second and/or millisecond.

-

pub fn and_hms_micro(
    &self,
    hour: u32,
    min: u32,
    sec: u32,
    micro: u32
) -> DateTime<Tz>
[src]

Makes a new DateTime from the current date, hour, minute, second and microsecond. -The microsecond part can exceed 1,000,000 in order to represent the leap second. -The offset in the current date is preserved.

-

Panics on invalid hour, minute, second and/or microsecond.

-

pub fn and_hms_micro_opt(
    &self,
    hour: u32,
    min: u32,
    sec: u32,
    micro: u32
) -> Option<DateTime<Tz>>
[src]

Makes a new DateTime from the current date, hour, minute, second and microsecond. -The microsecond part can exceed 1,000,000 in order to represent the leap second. -The offset in the current date is preserved.

-

Returns None on invalid hour, minute, second and/or microsecond.

-

pub fn and_hms_nano(
    &self,
    hour: u32,
    min: u32,
    sec: u32,
    nano: u32
) -> DateTime<Tz>
[src]

Makes a new DateTime from the current date, hour, minute, second and nanosecond. -The nanosecond part can exceed 1,000,000,000 in order to represent the leap second. -The offset in the current date is preserved.

-

Panics on invalid hour, minute, second and/or nanosecond.

-

pub fn and_hms_nano_opt(
    &self,
    hour: u32,
    min: u32,
    sec: u32,
    nano: u32
) -> Option<DateTime<Tz>>
[src]

Makes a new DateTime from the current date, hour, minute, second and nanosecond. -The nanosecond part can exceed 1,000,000,000 in order to represent the leap second. -The offset in the current date is preserved.

-

Returns None on invalid hour, minute, second and/or nanosecond.

-

pub fn succ(&self) -> Date<Tz>[src]

Makes a new Date for the next date.

-

Panics when self is the last representable date.

-

pub fn succ_opt(&self) -> Option<Date<Tz>>[src]

Makes a new Date for the next date.

-

Returns None when self is the last representable date.

-

pub fn pred(&self) -> Date<Tz>[src]

Makes a new Date for the prior date.

-

Panics when self is the first representable date.

-

pub fn pred_opt(&self) -> Option<Date<Tz>>[src]

Makes a new Date for the prior date.

-

Returns None when self is the first representable date.

-

pub fn offset(&self) -> &Tz::Offset[src]

Retrieves an associated offset from UTC.

-

pub fn timezone(&self) -> Tz[src]

Retrieves an associated time zone.

-

pub fn with_timezone<Tz2: TimeZone>(&self, tz: &Tz2) -> Date<Tz2>[src]

Changes the associated time zone. -This does not change the actual Date (but will change the string representation).

-

pub fn checked_add_signed(self, rhs: OldDuration) -> Option<Date<Tz>>[src]

Adds given Duration to the current date.

-

Returns None when it will result in overflow.

-

pub fn checked_sub_signed(self, rhs: OldDuration) -> Option<Date<Tz>>[src]

Subtracts given Duration from the current date.

-

Returns None when it will result in overflow.

-

pub fn signed_duration_since<Tz2: TimeZone>(self, rhs: Date<Tz2>) -> OldDuration[src]

Subtracts another Date from the current date. -Returns a Duration of integral numbers.

-

This does not overflow or underflow at all, -as all possible output fits in the range of Duration.

-

pub fn naive_utc(&self) -> NaiveDate[src]

Returns a view to the naive UTC date.

-

pub fn naive_local(&self) -> NaiveDate[src]

Returns a view to the naive local date.

-

This is technically the same as naive_utc -because the offset is restricted to never exceed one day, -but provided for the consistency.

-

impl<Tz: TimeZone> Date<Tz> where
    Tz::Offset: Display
[src]

pub fn format_with_items<'a, I, B>(&self, items: I) -> DelayedFormat<I> where
    I: Iterator<Item = B> + Clone,
    B: Borrow<Item<'a>>, 
[src]

Formats the date with the specified formatting items.

-

pub fn format<'a>(&self, fmt: &'a str) -> DelayedFormat<StrftimeItems<'a>>[src]

Formats the date with the specified format string. -See the format::strftime module -on the supported escape sequences.

-

Trait Implementations

impl<Tz: TimeZone> Add<Duration> for Date<Tz>[src]

type Output = Date<Tz>

The resulting type after applying the + operator.

-

impl<Tz: Clone + TimeZone> Clone for Date<Tz> where
    Tz::Offset: Clone
[src]

impl<Tz: TimeZone> Copy for Date<Tz> where
    <Tz as TimeZone>::Offset: Copy
[src]

impl<Tz: TimeZone> Datelike for Date<Tz>[src]

impl<Tz: TimeZone> Debug for Date<Tz>[src]

impl<Tz: TimeZone> Display for Date<Tz> where
    Tz::Offset: Display
[src]

impl<Tz: TimeZone> Eq for Date<Tz>[src]

impl<Tz: TimeZone> Hash for Date<Tz>[src]

impl<Tz: TimeZone> Ord for Date<Tz>[src]

impl<Tz: TimeZone, Tz2: TimeZone> PartialEq<Date<Tz2>> for Date<Tz>[src]

impl<Tz: TimeZone> PartialOrd<Date<Tz>> for Date<Tz>[src]

impl<Tz: TimeZone> Send for Date<Tz> where
    <Tz as TimeZone>::Offset: Send
[src]

impl<Tz: TimeZone> Sub<Date<Tz>> for Date<Tz>[src]

type Output = OldDuration

The resulting type after applying the - operator.

-

impl<Tz: TimeZone> Sub<Duration> for Date<Tz>[src]

type Output = Date<Tz>

The resulting type after applying the - operator.

-

Auto Trait Implementations

impl<Tz> RefUnwindSafe for Date<Tz> where
    <Tz as TimeZone>::Offset: RefUnwindSafe
[src]

impl<Tz> Sync for Date<Tz> where
    <Tz as TimeZone>::Offset: Sync
[src]

impl<Tz> Unpin for Date<Tz> where
    <Tz as TimeZone>::Offset: Unpin
[src]

impl<Tz> UnwindSafe for Date<Tz> where
    <Tz as TimeZone>::Offset: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

-

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-
\ No newline at end of file diff --git a/docs/chrono/struct.DateTime.html b/docs/chrono/struct.DateTime.html deleted file mode 100644 index 2cd65e77..00000000 --- a/docs/chrono/struct.DateTime.html +++ /dev/null @@ -1,249 +0,0 @@ -chrono::DateTime - Rust - -

[][src]Struct chrono::DateTime

pub struct DateTime<Tz: TimeZone> { /* fields omitted */ }

ISO 8601 combined date and time with time zone.

-

There are some constructors implemented here (the from_* methods), but -the general-purpose constructors are all via the methods on the -TimeZone implementations.

-

Implementations

impl<Tz: TimeZone> DateTime<Tz>[src]

pub fn from_utc(datetime: NaiveDateTime, offset: Tz::Offset) -> DateTime<Tz>[src]

Makes a new DateTime with given UTC datetime and offset. -The local datetime should be constructed via the TimeZone trait.

-

Example

-
-use chrono::{DateTime, TimeZone, NaiveDateTime, Utc};
-
-let dt = DateTime::<Utc>::from_utc(NaiveDateTime::from_timestamp(61, 0), Utc);
-assert_eq!(Utc.timestamp(61, 0), dt);
-

pub fn date(&self) -> Date<Tz>[src]

Retrieves a date component.

-

pub fn time(&self) -> NaiveTime[src]

Retrieves a time component. -Unlike date, this is not associated to the time zone.

-

pub fn timestamp(&self) -> i64[src]

Returns the number of non-leap seconds since January 1, 1970 0:00:00 UTC -(aka "UNIX timestamp").

-

pub fn timestamp_millis(&self) -> i64[src]

Returns the number of non-leap-milliseconds since January 1, 1970 UTC

-

Note that this does reduce the number of years that can be represented -from ~584 Billion to ~584 Million. (If this is a problem, please file -an issue to let me know what domain needs millisecond precision over -billions of years, I'm curious.)

-

Example

-
-use chrono::Utc;
-use chrono::TimeZone;
-
-let dt = Utc.ymd(1970, 1, 1).and_hms_milli(0, 0, 1, 444);
-assert_eq!(dt.timestamp_millis(), 1_444);
-
-let dt = Utc.ymd(2001, 9, 9).and_hms_milli(1, 46, 40, 555);
-assert_eq!(dt.timestamp_millis(), 1_000_000_000_555);
-

pub fn timestamp_nanos(&self) -> i64[src]

Returns the number of non-leap-nanoseconds since January 1, 1970 UTC

-

Note that this does reduce the number of years that can be represented -from ~584 Billion to ~584. (If this is a problem, please file -an issue to let me know what domain needs nanosecond precision over -millennia, I'm curious.)

-

Example

-
-use chrono::Utc;
-use chrono::TimeZone;
-
-let dt = Utc.ymd(1970, 1, 1).and_hms_nano(0, 0, 1, 444);
-assert_eq!(dt.timestamp_nanos(), 1_000_000_444);
-
-let dt = Utc.ymd(2001, 9, 9).and_hms_nano(1, 46, 40, 555);
-assert_eq!(dt.timestamp_nanos(), 1_000_000_000_000_000_555);
-

pub fn timestamp_subsec_millis(&self) -> u32[src]

Returns the number of milliseconds since the last second boundary

-

warning: in event of a leap second, this may exceed 999

-

note: this is not the number of milliseconds since January 1, 1970 0:00:00 UTC

-

pub fn timestamp_subsec_micros(&self) -> u32[src]

Returns the number of microseconds since the last second boundary

-

warning: in event of a leap second, this may exceed 999_999

-

note: this is not the number of microseconds since January 1, 1970 0:00:00 UTC

-

pub fn timestamp_subsec_nanos(&self) -> u32[src]

Returns the number of nanoseconds since the last second boundary

-

warning: in event of a leap second, this may exceed 999_999_999

-

note: this is not the number of nanoseconds since January 1, 1970 0:00:00 UTC

-

pub fn offset(&self) -> &Tz::Offset[src]

Retrieves an associated offset from UTC.

-

pub fn timezone(&self) -> Tz[src]

Retrieves an associated time zone.

-

pub fn with_timezone<Tz2: TimeZone>(&self, tz: &Tz2) -> DateTime<Tz2>[src]

Changes the associated time zone. -This does not change the actual DateTime (but will change the string representation).

-

pub fn checked_add_signed(self, rhs: OldDuration) -> Option<DateTime<Tz>>[src]

Adds given Duration to the current date and time.

-

Returns None when it will result in overflow.

-

pub fn checked_sub_signed(self, rhs: OldDuration) -> Option<DateTime<Tz>>[src]

Subtracts given Duration from the current date and time.

-

Returns None when it will result in overflow.

-

pub fn signed_duration_since<Tz2: TimeZone>(
    self,
    rhs: DateTime<Tz2>
) -> OldDuration
[src]

Subtracts another DateTime from the current date and time. -This does not overflow or underflow at all.

-

pub fn naive_utc(&self) -> NaiveDateTime[src]

Returns a view to the naive UTC datetime.

-

pub fn naive_local(&self) -> NaiveDateTime[src]

Returns a view to the naive local datetime.

-

impl DateTime<FixedOffset>[src]

pub fn parse_from_rfc2822(s: &str) -> ParseResult<DateTime<FixedOffset>>[src]

Parses an RFC 2822 date and time string such as Tue, 1 Jul 2003 10:52:37 +0200, -then returns a new DateTime with a parsed FixedOffset.

-

RFC 2822 is the internet message standard that specifices the -representation of times in HTTP and email headers.

- -
-assert_eq!(
-    DateTime::parse_from_rfc2822("Wed, 18 Feb 2015 23:16:09 GMT").unwrap(),
-    FixedOffset::east(0).ymd(2015, 2, 18).and_hms(23, 16, 9)
-);
-

pub fn parse_from_rfc3339(s: &str) -> ParseResult<DateTime<FixedOffset>>[src]

Parses an RFC 3339 and ISO 8601 date and time string such as 1996-12-19T16:39:57-08:00, -then returns a new DateTime with a parsed FixedOffset.

-

Why isn't this named parse_from_iso8601? That's because ISO 8601 allows some freedom -over the syntax and RFC 3339 exercises that freedom to rigidly define a fixed format.

-

pub fn parse_from_str(s: &str, fmt: &str) -> ParseResult<DateTime<FixedOffset>>[src]

Parses a string with the specified format string and -returns a new DateTime with a parsed FixedOffset. -See the format::strftime module -on the supported escape sequences.

-

See also Offset::datetime_from_str which gives a local DateTime on specific time zone.

-

Note that this method requires a timezone in the string. See -NaiveDateTime::parse_from_str -for a version that does not require a timezone in the to-be-parsed str.

-

Example

-
-use chrono::{DateTime, FixedOffset, TimeZone};
-
-let dt = DateTime::parse_from_str(
-    "1983 Apr 13 12:09:14.274 +0000", "%Y %b %d %H:%M:%S%.3f %z");
-assert_eq!(dt, Ok(FixedOffset::east(0).ymd(1983, 4, 13).and_hms_milli(12, 9, 14, 274)));
-

impl<Tz: TimeZone> DateTime<Tz> where
    Tz::Offset: Display
[src]

pub fn to_rfc2822(&self) -> String[src]

Returns an RFC 2822 date and time string such as Tue, 1 Jul 2003 10:52:37 +0200.

-

pub fn to_rfc3339(&self) -> String[src]

Returns an RFC 3339 and ISO 8601 date and time string such as 1996-12-19T16:39:57-08:00.

-

pub fn to_rfc3339_opts(&self, secform: SecondsFormat, use_z: bool) -> String[src]

Return an RFC 3339 and ISO 8601 date and time string with subseconds -formatted as per a SecondsFormat. If passed use_z true and the -timezone is UTC (offset 0), use 'Z', as per -Fixed::TimezoneOffsetColonZ. -If passed use_z false, use -Fixed::TimezoneOffsetColon.

-

Examples

-
-let dt = Utc.ymd(2018, 1, 26).and_hms_micro(18, 30, 9, 453_829);
-assert_eq!(dt.to_rfc3339_opts(SecondsFormat::Millis, false),
-           "2018-01-26T18:30:09.453+00:00");
-assert_eq!(dt.to_rfc3339_opts(SecondsFormat::Millis, true),
-           "2018-01-26T18:30:09.453Z");
-assert_eq!(dt.to_rfc3339_opts(SecondsFormat::Secs, true),
-           "2018-01-26T18:30:09Z");
-
-let pst = FixedOffset::east(8 * 60 * 60);
-let dt = pst.ymd(2018, 1, 26).and_hms_micro(10, 30, 9, 453_829);
-assert_eq!(dt.to_rfc3339_opts(SecondsFormat::Secs, true),
-           "2018-01-26T10:30:09+08:00");
-

pub fn format_with_items<'a, I, B>(&self, items: I) -> DelayedFormat<I> where
    I: Iterator<Item = B> + Clone,
    B: Borrow<Item<'a>>, 
[src]

Formats the combined date and time with the specified formatting items.

-

pub fn format<'a>(&self, fmt: &'a str) -> DelayedFormat<StrftimeItems<'a>>[src]

Formats the combined date and time with the specified format string. -See the format::strftime module -on the supported escape sequences.

-

Trait Implementations

impl<Tz: TimeZone> Add<Duration> for DateTime<Tz>[src]

type Output = DateTime<Tz>

The resulting type after applying the + operator.

-

impl<Tz: TimeZone> Add<FixedOffset> for DateTime<Tz>[src]

type Output = DateTime<Tz>

The resulting type after applying the + operator.

-

impl<Tz: Clone + TimeZone> Clone for DateTime<Tz> where
    Tz::Offset: Clone
[src]

impl<Tz: TimeZone> Copy for DateTime<Tz> where
    <Tz as TimeZone>::Offset: Copy
[src]

impl<Tz: TimeZone> Datelike for DateTime<Tz>[src]

impl<Tz: TimeZone> Debug for DateTime<Tz>[src]

impl<Tz: TimeZone> Display for DateTime<Tz> where
    Tz::Offset: Display
[src]

impl<Tz: TimeZone> DurationRound for DateTime<Tz>[src]

type Err = RoundingError

Error that can occur in rounding or truncating

-

impl<Tz: TimeZone> Eq for DateTime<Tz>[src]

impl From<DateTime<FixedOffset>> for DateTime<Utc>[src]

Convert a DateTime<FixedOffset> instance into a DateTime<Utc> instance.

-

fn from(src: DateTime<FixedOffset>) -> Self[src]

Convert this DateTime<FixedOffset> instance into a DateTime<Utc> instance.

-

Conversion is performed via DateTime::with_timezone, accounting for the timezone -difference.

-

impl From<DateTime<FixedOffset>> for DateTime<Local>[src]

Convert a DateTime<FixedOffset> instance into a DateTime<Local> instance.

-

fn from(src: DateTime<FixedOffset>) -> Self[src]

Convert this DateTime<FixedOffset> instance into a DateTime<Local> instance.

-

Conversion is performed via DateTime::with_timezone. Returns the equivalent value in local -time.

-

impl From<DateTime<Local>> for DateTime<Utc>[src]

Convert a DateTime<Local> instance into a DateTime<Utc> instance.

-

fn from(src: DateTime<Local>) -> Self[src]

Convert this DateTime<Local> instance into a DateTime<Utc> instance.

-

Conversion is performed via DateTime::with_timezone, accounting for the difference in -timezones.

-

impl From<DateTime<Local>> for DateTime<FixedOffset>[src]

Convert a DateTime<Local> instance into a DateTime<FixedOffset> instance.

-

fn from(src: DateTime<Local>) -> Self[src]

Convert this DateTime<Local> instance into a DateTime<FixedOffset> instance.

-

Conversion is performed via DateTime::with_timezone. Note that the converted value returned -by this will be created with a fixed timezone offset of 0.

-

impl<Tz: TimeZone> From<DateTime<Tz>> for SystemTime[src]

impl From<DateTime<Utc>> for DateTime<FixedOffset>[src]

Convert a DateTime<Utc> instance into a DateTime<FixedOffset> instance.

-

fn from(src: DateTime<Utc>) -> Self[src]

Convert this DateTime<Utc> instance into a DateTime<FixedOffset> instance.

-

Conversion is done via DateTime::with_timezone. Note that the converted value returned by -this will be created with a fixed timezone offset of 0.

-

impl From<DateTime<Utc>> for DateTime<Local>[src]

Convert a DateTime<Utc> instance into a DateTime<Local> instance.

-

fn from(src: DateTime<Utc>) -> Self[src]

Convert this DateTime<Utc> instance into a DateTime<Local> instance.

-

Conversion is performed via DateTime::with_timezone, accounting for the difference in timezones.

-

impl From<SystemTime> for DateTime<Utc>[src]

impl From<SystemTime> for DateTime<Local>[src]

impl FromStr for DateTime<Utc>[src]

type Err = ParseError

The associated error which can be returned from parsing.

-

impl FromStr for DateTime<Local>[src]

type Err = ParseError

The associated error which can be returned from parsing.

-

impl FromStr for DateTime<FixedOffset>[src]

type Err = ParseError

The associated error which can be returned from parsing.

-

impl<Tz: TimeZone> Hash for DateTime<Tz>[src]

impl<Tz: TimeZone> Ord for DateTime<Tz>[src]

impl<Tz: TimeZone, Tz2: TimeZone> PartialEq<DateTime<Tz2>> for DateTime<Tz>[src]

impl<Tz: TimeZone, Tz2: TimeZone> PartialOrd<DateTime<Tz2>> for DateTime<Tz>[src]

fn partial_cmp(&self, other: &DateTime<Tz2>) -> Option<Ordering>[src]

Compare two DateTimes based on their true time, ignoring time zones

-

Example

-
-use chrono::prelude::*;
-
-let earlier = Utc.ymd(2015, 5, 15).and_hms(2, 0, 0).with_timezone(&FixedOffset::west(1 * 3600));
-let later   = Utc.ymd(2015, 5, 15).and_hms(3, 0, 0).with_timezone(&FixedOffset::west(5 * 3600));
-
-assert_eq!(earlier.to_string(), "2015-05-15 01:00:00 -01:00");
-assert_eq!(later.to_string(), "2015-05-14 22:00:00 -05:00");
-
-assert!(later > earlier);
-

impl<Tz: TimeZone> Send for DateTime<Tz> where
    <Tz as TimeZone>::Offset: Send
[src]

impl<Tz: TimeZone> Sub<DateTime<Tz>> for DateTime<Tz>[src]

type Output = OldDuration

The resulting type after applying the - operator.

-

impl<Tz: TimeZone> Sub<Duration> for DateTime<Tz>[src]

type Output = DateTime<Tz>

The resulting type after applying the - operator.

-

impl<Tz: TimeZone> Sub<FixedOffset> for DateTime<Tz>[src]

type Output = DateTime<Tz>

The resulting type after applying the - operator.

-

impl<Tz: TimeZone> Timelike for DateTime<Tz>[src]

Auto Trait Implementations

impl<Tz> RefUnwindSafe for DateTime<Tz> where
    <Tz as TimeZone>::Offset: RefUnwindSafe
[src]

impl<Tz> Sync for DateTime<Tz> where
    <Tz as TimeZone>::Offset: Sync
[src]

impl<Tz> Unpin for DateTime<Tz> where
    <Tz as TimeZone>::Offset: Unpin
[src]

impl<Tz> UnwindSafe for DateTime<Tz> where
    <Tz as TimeZone>::Offset: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

-

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-
\ No newline at end of file diff --git a/docs/chrono/struct.Duration.html b/docs/chrono/struct.Duration.html deleted file mode 100644 index 26d8545d..00000000 --- a/docs/chrono/struct.Duration.html +++ /dev/null @@ -1,302 +0,0 @@ -chrono::Duration - Rust - -

[][src]Struct chrono::Duration

pub struct Duration { /* fields omitted */ }

ISO 8601 time duration with nanosecond precision. -This also allows for the negative duration; see individual methods for details.

-

Implementations

impl Duration[src]

pub fn weeks(weeks: i64) -> Duration[src]

Makes a new Duration with given number of weeks. -Equivalent to Duration::seconds(weeks * 7 * 24 * 60 * 60) with overflow checks. -Panics when the duration is out of bounds.

-

pub fn days(days: i64) -> Duration[src]

Makes a new Duration with given number of days. -Equivalent to Duration::seconds(days * 24 * 60 * 60) with overflow checks. -Panics when the duration is out of bounds.

-

pub fn hours(hours: i64) -> Duration[src]

Makes a new Duration with given number of hours. -Equivalent to Duration::seconds(hours * 60 * 60) with overflow checks. -Panics when the duration is out of bounds.

-

pub fn minutes(minutes: i64) -> Duration[src]

Makes a new Duration with given number of minutes. -Equivalent to Duration::seconds(minutes * 60) with overflow checks. -Panics when the duration is out of bounds.

-

pub fn seconds(seconds: i64) -> Duration[src]

Makes a new Duration with given number of seconds. -Panics when the duration is more than i64::MAX milliseconds -or less than i64::MIN milliseconds.

-

pub fn milliseconds(milliseconds: i64) -> Duration[src]

Makes a new Duration with given number of milliseconds.

-

pub fn microseconds(microseconds: i64) -> Duration[src]

Makes a new Duration with given number of microseconds.

-

pub fn nanoseconds(nanos: i64) -> Duration[src]

Makes a new Duration with given number of nanoseconds.

-

pub fn span<F>(f: F) -> Duration where
    F: FnOnce(), 
[src]

Runs a closure, returning the duration of time it took to run the -closure.

-

pub fn num_weeks(&self) -> i64[src]

Returns the total number of whole weeks in the duration.

-

pub fn num_days(&self) -> i64[src]

Returns the total number of whole days in the duration.

-

pub fn num_hours(&self) -> i64[src]

Returns the total number of whole hours in the duration.

-

pub fn num_minutes(&self) -> i64[src]

Returns the total number of whole minutes in the duration.

-

pub fn num_seconds(&self) -> i64[src]

Returns the total number of whole seconds in the duration.

-

pub fn num_milliseconds(&self) -> i64[src]

Returns the total number of whole milliseconds in the duration,

-

pub fn num_microseconds(&self) -> Option<i64>[src]

Returns the total number of whole microseconds in the duration, -or None on overflow (exceeding 263 microseconds in either direction).

-

pub fn num_nanoseconds(&self) -> Option<i64>[src]

Returns the total number of whole nanoseconds in the duration, -or None on overflow (exceeding 263 nanoseconds in either direction).

-

pub fn checked_add(&self, rhs: &Duration) -> Option<Duration>[src]

Add two durations, returning None if overflow occurred.

-

pub fn checked_sub(&self, rhs: &Duration) -> Option<Duration>[src]

Subtract two durations, returning None if overflow occurred.

-

pub fn min_value() -> Duration[src]

The minimum possible Duration: i64::MIN milliseconds.

-

pub fn max_value() -> Duration[src]

The maximum possible Duration: i64::MAX milliseconds.

-

pub fn zero() -> Duration[src]

A duration where the stored seconds and nanoseconds are equal to zero.

-

pub fn is_zero(&self) -> bool[src]

Returns true if the duration equals Duration::zero().

-

pub fn from_std(duration: Duration) -> Result<Duration, OutOfRangeError>[src]

Creates a time::Duration object from std::time::Duration

-

This function errors when original duration is larger than the maximum -value supported for this type.

-

pub fn to_std(&self) -> Result<Duration, OutOfRangeError>[src]

Creates a std::time::Duration object from time::Duration

-

This function errors when duration is less than zero. As standard -library implementation is limited to non-negative values.

-

Trait Implementations

impl Add<Duration> for Duration[src]

type Output = Duration

The resulting type after applying the + operator.

-

impl Add<Duration> for NaiveDate[src]

An addition of Duration to NaiveDate discards the fractional days, -rounding to the closest integral number of days towards Duration::zero().

-

Panics on underflow or overflow. -Use NaiveDate::checked_add_signed to detect that.

-

Example

-
-use chrono::{Duration, NaiveDate};
-
-let from_ymd = NaiveDate::from_ymd;
-
-assert_eq!(from_ymd(2014, 1, 1) + Duration::zero(),             from_ymd(2014, 1, 1));
-assert_eq!(from_ymd(2014, 1, 1) + Duration::seconds(86399),     from_ymd(2014, 1, 1));
-assert_eq!(from_ymd(2014, 1, 1) + Duration::seconds(-86399),    from_ymd(2014, 1, 1));
-assert_eq!(from_ymd(2014, 1, 1) + Duration::days(1),            from_ymd(2014, 1, 2));
-assert_eq!(from_ymd(2014, 1, 1) + Duration::days(-1),           from_ymd(2013, 12, 31));
-assert_eq!(from_ymd(2014, 1, 1) + Duration::days(364),          from_ymd(2014, 12, 31));
-assert_eq!(from_ymd(2014, 1, 1) + Duration::days(365*4 + 1),    from_ymd(2018, 1, 1));
-assert_eq!(from_ymd(2014, 1, 1) + Duration::days(365*400 + 97), from_ymd(2414, 1, 1));
-

type Output = NaiveDate

The resulting type after applying the + operator.

-

impl Add<Duration> for NaiveDateTime[src]

An addition of Duration to NaiveDateTime yields another NaiveDateTime.

-

As a part of Chrono's leap second handling, -the addition assumes that there is no leap second ever, -except when the NaiveDateTime itself represents a leap second -in which case the assumption becomes that there is exactly a single leap second ever.

-

Panics on underflow or overflow. -Use NaiveDateTime::checked_add_signed to detect that.

-

Example

-
-use chrono::{Duration, NaiveDate};
-
-let from_ymd = NaiveDate::from_ymd;
-
-let d = from_ymd(2016, 7, 8);
-let hms = |h, m, s| d.and_hms(h, m, s);
-assert_eq!(hms(3, 5, 7) + Duration::zero(),             hms(3, 5, 7));
-assert_eq!(hms(3, 5, 7) + Duration::seconds(1),         hms(3, 5, 8));
-assert_eq!(hms(3, 5, 7) + Duration::seconds(-1),        hms(3, 5, 6));
-assert_eq!(hms(3, 5, 7) + Duration::seconds(3600 + 60), hms(4, 6, 7));
-assert_eq!(hms(3, 5, 7) + Duration::seconds(86_400),
-           from_ymd(2016, 7, 9).and_hms(3, 5, 7));
-assert_eq!(hms(3, 5, 7) + Duration::days(365),
-           from_ymd(2017, 7, 8).and_hms(3, 5, 7));
-
-let hmsm = |h, m, s, milli| d.and_hms_milli(h, m, s, milli);
-assert_eq!(hmsm(3, 5, 7, 980) + Duration::milliseconds(450), hmsm(3, 5, 8, 430));
-

Leap seconds are handled, -but the addition assumes that it is the only leap second happened.

- -
-let leap = hmsm(3, 5, 59, 1_300);
-assert_eq!(leap + Duration::zero(),             hmsm(3, 5, 59, 1_300));
-assert_eq!(leap + Duration::milliseconds(-500), hmsm(3, 5, 59, 800));
-assert_eq!(leap + Duration::milliseconds(500),  hmsm(3, 5, 59, 1_800));
-assert_eq!(leap + Duration::milliseconds(800),  hmsm(3, 6, 0, 100));
-assert_eq!(leap + Duration::seconds(10),        hmsm(3, 6, 9, 300));
-assert_eq!(leap + Duration::seconds(-10),       hmsm(3, 5, 50, 300));
-assert_eq!(leap + Duration::days(1),
-           from_ymd(2016, 7, 9).and_hms_milli(3, 5, 59, 300));
-

type Output = NaiveDateTime

The resulting type after applying the + operator.

-

impl Add<Duration> for NaiveTime[src]

An addition of Duration to NaiveTime wraps around and never overflows or underflows. -In particular the addition ignores integral number of days.

-

As a part of Chrono's leap second handling, -the addition assumes that there is no leap second ever, -except when the NaiveTime itself represents a leap second -in which case the assumption becomes that there is exactly a single leap second ever.

-

Example

-
-use chrono::{Duration, NaiveTime};
-
-let from_hmsm = NaiveTime::from_hms_milli;
-
-assert_eq!(from_hmsm(3, 5, 7, 0) + Duration::zero(),                  from_hmsm(3, 5, 7, 0));
-assert_eq!(from_hmsm(3, 5, 7, 0) + Duration::seconds(1),              from_hmsm(3, 5, 8, 0));
-assert_eq!(from_hmsm(3, 5, 7, 0) + Duration::seconds(-1),             from_hmsm(3, 5, 6, 0));
-assert_eq!(from_hmsm(3, 5, 7, 0) + Duration::seconds(60 + 4),         from_hmsm(3, 6, 11, 0));
-assert_eq!(from_hmsm(3, 5, 7, 0) + Duration::seconds(7*60*60 - 6*60), from_hmsm(9, 59, 7, 0));
-assert_eq!(from_hmsm(3, 5, 7, 0) + Duration::milliseconds(80),        from_hmsm(3, 5, 7, 80));
-assert_eq!(from_hmsm(3, 5, 7, 950) + Duration::milliseconds(280),     from_hmsm(3, 5, 8, 230));
-assert_eq!(from_hmsm(3, 5, 7, 950) + Duration::milliseconds(-980),    from_hmsm(3, 5, 6, 970));
-

The addition wraps around.

- -
-assert_eq!(from_hmsm(3, 5, 7, 0) + Duration::seconds(22*60*60), from_hmsm(1, 5, 7, 0));
-assert_eq!(from_hmsm(3, 5, 7, 0) + Duration::seconds(-8*60*60), from_hmsm(19, 5, 7, 0));
-assert_eq!(from_hmsm(3, 5, 7, 0) + Duration::days(800),         from_hmsm(3, 5, 7, 0));
-

Leap seconds are handled, but the addition assumes that it is the only leap second happened.

- -
-let leap = from_hmsm(3, 5, 59, 1_300);
-assert_eq!(leap + Duration::zero(),             from_hmsm(3, 5, 59, 1_300));
-assert_eq!(leap + Duration::milliseconds(-500), from_hmsm(3, 5, 59, 800));
-assert_eq!(leap + Duration::milliseconds(500),  from_hmsm(3, 5, 59, 1_800));
-assert_eq!(leap + Duration::milliseconds(800),  from_hmsm(3, 6, 0, 100));
-assert_eq!(leap + Duration::seconds(10),        from_hmsm(3, 6, 9, 300));
-assert_eq!(leap + Duration::seconds(-10),       from_hmsm(3, 5, 50, 300));
-assert_eq!(leap + Duration::days(1),            from_hmsm(3, 5, 59, 300));
-

type Output = NaiveTime

The resulting type after applying the + operator.

-

impl<Tz: TimeZone> Add<Duration> for Date<Tz>[src]

type Output = Date<Tz>

The resulting type after applying the + operator.

-

impl<Tz: TimeZone> Add<Duration> for DateTime<Tz>[src]

type Output = DateTime<Tz>

The resulting type after applying the + operator.

-

impl AddAssign<Duration> for NaiveDate[src]

impl AddAssign<Duration> for NaiveDateTime[src]

impl AddAssign<Duration> for NaiveTime[src]

impl Clone for Duration[src]

impl Copy for Duration[src]

impl Debug for Duration[src]

impl Display for Duration[src]

impl Div<i32> for Duration[src]

type Output = Duration

The resulting type after applying the / operator.

-

impl Eq for Duration[src]

impl Hash for Duration[src]

impl Mul<i32> for Duration[src]

type Output = Duration

The resulting type after applying the * operator.

-

impl Neg for Duration[src]

type Output = Duration

The resulting type after applying the - operator.

-

impl Ord for Duration[src]

impl PartialEq<Duration> for Duration[src]

impl PartialOrd<Duration> for Duration[src]

impl StructuralEq for Duration[src]

impl StructuralPartialEq for Duration[src]

impl Sub<Duration> for Duration[src]

type Output = Duration

The resulting type after applying the - operator.

-

impl Sub<Duration> for NaiveDate[src]

A subtraction of Duration from NaiveDate discards the fractional days, -rounding to the closest integral number of days towards Duration::zero(). -It is the same as the addition with a negated Duration.

-

Panics on underflow or overflow. -Use NaiveDate::checked_sub_signed to detect that.

-

Example

-
-use chrono::{Duration, NaiveDate};
-
-let from_ymd = NaiveDate::from_ymd;
-
-assert_eq!(from_ymd(2014, 1, 1) - Duration::zero(),             from_ymd(2014, 1, 1));
-assert_eq!(from_ymd(2014, 1, 1) - Duration::seconds(86399),     from_ymd(2014, 1, 1));
-assert_eq!(from_ymd(2014, 1, 1) - Duration::seconds(-86399),    from_ymd(2014, 1, 1));
-assert_eq!(from_ymd(2014, 1, 1) - Duration::days(1),            from_ymd(2013, 12, 31));
-assert_eq!(from_ymd(2014, 1, 1) - Duration::days(-1),           from_ymd(2014, 1, 2));
-assert_eq!(from_ymd(2014, 1, 1) - Duration::days(364),          from_ymd(2013, 1, 2));
-assert_eq!(from_ymd(2014, 1, 1) - Duration::days(365*4 + 1),    from_ymd(2010, 1, 1));
-assert_eq!(from_ymd(2014, 1, 1) - Duration::days(365*400 + 97), from_ymd(1614, 1, 1));
-

type Output = NaiveDate

The resulting type after applying the - operator.

-

impl Sub<Duration> for NaiveDateTime[src]

A subtraction of Duration from NaiveDateTime yields another NaiveDateTime. -It is the same as the addition with a negated Duration.

-

As a part of Chrono's leap second handling, -the addition assumes that there is no leap second ever, -except when the NaiveDateTime itself represents a leap second -in which case the assumption becomes that there is exactly a single leap second ever.

-

Panics on underflow or overflow. -Use NaiveDateTime::checked_sub_signed to detect that.

-

Example

-
-use chrono::{Duration, NaiveDate};
-
-let from_ymd = NaiveDate::from_ymd;
-
-let d = from_ymd(2016, 7, 8);
-let hms = |h, m, s| d.and_hms(h, m, s);
-assert_eq!(hms(3, 5, 7) - Duration::zero(),             hms(3, 5, 7));
-assert_eq!(hms(3, 5, 7) - Duration::seconds(1),         hms(3, 5, 6));
-assert_eq!(hms(3, 5, 7) - Duration::seconds(-1),        hms(3, 5, 8));
-assert_eq!(hms(3, 5, 7) - Duration::seconds(3600 + 60), hms(2, 4, 7));
-assert_eq!(hms(3, 5, 7) - Duration::seconds(86_400),
-           from_ymd(2016, 7, 7).and_hms(3, 5, 7));
-assert_eq!(hms(3, 5, 7) - Duration::days(365),
-           from_ymd(2015, 7, 9).and_hms(3, 5, 7));
-
-let hmsm = |h, m, s, milli| d.and_hms_milli(h, m, s, milli);
-assert_eq!(hmsm(3, 5, 7, 450) - Duration::milliseconds(670), hmsm(3, 5, 6, 780));
-

Leap seconds are handled, -but the subtraction assumes that it is the only leap second happened.

- -
-let leap = hmsm(3, 5, 59, 1_300);
-assert_eq!(leap - Duration::zero(),            hmsm(3, 5, 59, 1_300));
-assert_eq!(leap - Duration::milliseconds(200), hmsm(3, 5, 59, 1_100));
-assert_eq!(leap - Duration::milliseconds(500), hmsm(3, 5, 59, 800));
-assert_eq!(leap - Duration::seconds(60),       hmsm(3, 5, 0, 300));
-assert_eq!(leap - Duration::days(1),
-           from_ymd(2016, 7, 7).and_hms_milli(3, 6, 0, 300));
-

type Output = NaiveDateTime

The resulting type after applying the - operator.

-

impl Sub<Duration> for NaiveTime[src]

A subtraction of Duration from NaiveTime wraps around and never overflows or underflows. -In particular the addition ignores integral number of days. -It is the same as the addition with a negated Duration.

-

As a part of Chrono's leap second handling, -the addition assumes that there is no leap second ever, -except when the NaiveTime itself represents a leap second -in which case the assumption becomes that there is exactly a single leap second ever.

-

Example

-
-use chrono::{Duration, NaiveTime};
-
-let from_hmsm = NaiveTime::from_hms_milli;
-
-assert_eq!(from_hmsm(3, 5, 7, 0) - Duration::zero(),                  from_hmsm(3, 5, 7, 0));
-assert_eq!(from_hmsm(3, 5, 7, 0) - Duration::seconds(1),              from_hmsm(3, 5, 6, 0));
-assert_eq!(from_hmsm(3, 5, 7, 0) - Duration::seconds(60 + 5),         from_hmsm(3, 4, 2, 0));
-assert_eq!(from_hmsm(3, 5, 7, 0) - Duration::seconds(2*60*60 + 6*60), from_hmsm(0, 59, 7, 0));
-assert_eq!(from_hmsm(3, 5, 7, 0) - Duration::milliseconds(80),        from_hmsm(3, 5, 6, 920));
-assert_eq!(from_hmsm(3, 5, 7, 950) - Duration::milliseconds(280),     from_hmsm(3, 5, 7, 670));
-

The subtraction wraps around.

- -
-assert_eq!(from_hmsm(3, 5, 7, 0) - Duration::seconds(8*60*60), from_hmsm(19, 5, 7, 0));
-assert_eq!(from_hmsm(3, 5, 7, 0) - Duration::days(800),        from_hmsm(3, 5, 7, 0));
-

Leap seconds are handled, but the subtraction assumes that it is the only leap second happened.

- -
-let leap = from_hmsm(3, 5, 59, 1_300);
-assert_eq!(leap - Duration::zero(),            from_hmsm(3, 5, 59, 1_300));
-assert_eq!(leap - Duration::milliseconds(200), from_hmsm(3, 5, 59, 1_100));
-assert_eq!(leap - Duration::milliseconds(500), from_hmsm(3, 5, 59, 800));
-assert_eq!(leap - Duration::seconds(60),       from_hmsm(3, 5, 0, 300));
-assert_eq!(leap - Duration::days(1),           from_hmsm(3, 6, 0, 300));
-

type Output = NaiveTime

The resulting type after applying the - operator.

-

impl<Tz: TimeZone> Sub<Duration> for Date<Tz>[src]

type Output = Date<Tz>

The resulting type after applying the - operator.

-

impl<Tz: TimeZone> Sub<Duration> for DateTime<Tz>[src]

type Output = DateTime<Tz>

The resulting type after applying the - operator.

-

impl SubAssign<Duration> for NaiveDate[src]

impl SubAssign<Duration> for NaiveDateTime[src]

impl SubAssign<Duration> for NaiveTime[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

-

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-
\ No newline at end of file diff --git a/docs/chrono/struct.ParseMonthError.html b/docs/chrono/struct.ParseMonthError.html deleted file mode 100644 index c9fc5447..00000000 --- a/docs/chrono/struct.ParseMonthError.html +++ /dev/null @@ -1,24 +0,0 @@ -chrono::ParseMonthError - Rust - -

[][src]Struct chrono::ParseMonthError

pub struct ParseMonthError { /* fields omitted */ }

An error resulting from reading <Month> value with FromStr.

-

Trait Implementations

impl Clone for ParseMonthError[src]

impl Debug for ParseMonthError[src]

impl PartialEq<ParseMonthError> for ParseMonthError[src]

impl StructuralPartialEq for ParseMonthError[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

-

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-
\ No newline at end of file diff --git a/docs/chrono/struct.ParseWeekdayError.html b/docs/chrono/struct.ParseWeekdayError.html deleted file mode 100644 index b2b059d3..00000000 --- a/docs/chrono/struct.ParseWeekdayError.html +++ /dev/null @@ -1,24 +0,0 @@ -chrono::ParseWeekdayError - Rust - -

[][src]Struct chrono::ParseWeekdayError

pub struct ParseWeekdayError { /* fields omitted */ }

An error resulting from reading Weekday value with FromStr.

-

Trait Implementations

impl Clone for ParseWeekdayError[src]

impl Debug for ParseWeekdayError[src]

impl PartialEq<ParseWeekdayError> for ParseWeekdayError[src]

impl StructuralPartialEq for ParseWeekdayError[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

-

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-
\ No newline at end of file diff --git a/docs/chrono/trait.Datelike.html b/docs/chrono/trait.Datelike.html deleted file mode 100644 index 88c96e27..00000000 --- a/docs/chrono/trait.Datelike.html +++ /dev/null @@ -1,416 +0,0 @@ -chrono::Datelike - Rust - -

[][src]Trait chrono::Datelike

pub trait Datelike: Sized {
-    fn year(&self) -> i32;
-
fn month(&self) -> u32; -
fn month0(&self) -> u32; -
fn day(&self) -> u32; -
fn day0(&self) -> u32; -
fn ordinal(&self) -> u32; -
fn ordinal0(&self) -> u32; -
fn weekday(&self) -> Weekday; -
fn iso_week(&self) -> IsoWeek; -
fn with_year(&self, year: i32) -> Option<Self>; -
fn with_month(&self, month: u32) -> Option<Self>; -
fn with_month0(&self, month0: u32) -> Option<Self>; -
fn with_day(&self, day: u32) -> Option<Self>; -
fn with_day0(&self, day0: u32) -> Option<Self>; -
fn with_ordinal(&self, ordinal: u32) -> Option<Self>; -
fn with_ordinal0(&self, ordinal0: u32) -> Option<Self>; - - fn year_ce(&self) -> (bool, u32) { ... } -
fn num_days_from_ce(&self) -> i32 { ... } -}

The common set of methods for date component.

-

Required methods

fn year(&self) -> i32[src]

Returns the year number in the calendar date.

-

fn month(&self) -> u32[src]

Returns the month number starting from 1.

-

The return value ranges from 1 to 12.

-

fn month0(&self) -> u32[src]

Returns the month number starting from 0.

-

The return value ranges from 0 to 11.

-

fn day(&self) -> u32[src]

Returns the day of month starting from 1.

-

The return value ranges from 1 to 31. (The last day of month differs by months.)

-

fn day0(&self) -> u32[src]

Returns the day of month starting from 0.

-

The return value ranges from 0 to 30. (The last day of month differs by months.)

-

fn ordinal(&self) -> u32[src]

Returns the day of year starting from 1.

-

The return value ranges from 1 to 366. (The last day of year differs by years.)

-

fn ordinal0(&self) -> u32[src]

Returns the day of year starting from 0.

-

The return value ranges from 0 to 365. (The last day of year differs by years.)

-

fn weekday(&self) -> Weekday[src]

Returns the day of week.

-

fn iso_week(&self) -> IsoWeek[src]

Returns the ISO week.

-

fn with_year(&self, year: i32) -> Option<Self>[src]

Makes a new value with the year number changed.

-

Returns None when the resulting value would be invalid.

-

fn with_month(&self, month: u32) -> Option<Self>[src]

Makes a new value with the month number (starting from 1) changed.

-

Returns None when the resulting value would be invalid.

-

fn with_month0(&self, month0: u32) -> Option<Self>[src]

Makes a new value with the month number (starting from 0) changed.

-

Returns None when the resulting value would be invalid.

-

fn with_day(&self, day: u32) -> Option<Self>[src]

Makes a new value with the day of month (starting from 1) changed.

-

Returns None when the resulting value would be invalid.

-

fn with_day0(&self, day0: u32) -> Option<Self>[src]

Makes a new value with the day of month (starting from 0) changed.

-

Returns None when the resulting value would be invalid.

-

fn with_ordinal(&self, ordinal: u32) -> Option<Self>[src]

Makes a new value with the day of year (starting from 1) changed.

-

Returns None when the resulting value would be invalid.

-

fn with_ordinal0(&self, ordinal0: u32) -> Option<Self>[src]

Makes a new value with the day of year (starting from 0) changed.

-

Returns None when the resulting value would be invalid.

-
Loading content...

Provided methods

fn year_ce(&self) -> (bool, u32)[src]

Returns the absolute year number starting from 1 with a boolean flag, -which is false when the year predates the epoch (BCE/BC) and true otherwise (CE/AD).

-

fn num_days_from_ce(&self) -> i32[src]

Counts the days in the proleptic Gregorian calendar, with January 1, Year 1 (CE) as day 1.

-

Examples

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(1970, 1, 1).num_days_from_ce(), 719_163);
-assert_eq!(NaiveDate::from_ymd(2, 1, 1).num_days_from_ce(), 366);
-assert_eq!(NaiveDate::from_ymd(1, 1, 1).num_days_from_ce(), 1);
-assert_eq!(NaiveDate::from_ymd(0, 1, 1).num_days_from_ce(), -365);
-
Loading content...

Implementors

impl Datelike for NaiveDate[src]

fn year(&self) -> i32[src]

Returns the year number in the calendar date.

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).year(), 2015);
-assert_eq!(NaiveDate::from_ymd(-308, 3, 14).year(), -308); // 309 BCE
-

fn month(&self) -> u32[src]

Returns the month number starting from 1.

-

The return value ranges from 1 to 12.

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).month(), 9);
-assert_eq!(NaiveDate::from_ymd(-308, 3, 14).month(), 3);
-

fn month0(&self) -> u32[src]

Returns the month number starting from 0.

-

The return value ranges from 0 to 11.

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).month0(), 8);
-assert_eq!(NaiveDate::from_ymd(-308, 3, 14).month0(), 2);
-

fn day(&self) -> u32[src]

Returns the day of month starting from 1.

-

The return value ranges from 1 to 31. (The last day of month differs by months.)

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).day(), 8);
-assert_eq!(NaiveDate::from_ymd(-308, 3, 14).day(), 14);
-

Combined with NaiveDate::pred, -one can determine the number of days in a particular month. -(Note that this panics when year is out of range.)

- -
-use chrono::{NaiveDate, Datelike};
-
-fn ndays_in_month(year: i32, month: u32) -> u32 {
-    // the first day of the next month...
-    let (y, m) = if month == 12 { (year + 1, 1) } else { (year, month + 1) };
-    let d = NaiveDate::from_ymd(y, m, 1);
-
-    // ...is preceded by the last day of the original month
-    d.pred().day()
-}
-
-assert_eq!(ndays_in_month(2015, 8), 31);
-assert_eq!(ndays_in_month(2015, 9), 30);
-assert_eq!(ndays_in_month(2015, 12), 31);
-assert_eq!(ndays_in_month(2016, 2), 29);
-assert_eq!(ndays_in_month(2017, 2), 28);
-

fn day0(&self) -> u32[src]

Returns the day of month starting from 0.

-

The return value ranges from 0 to 30. (The last day of month differs by months.)

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).day0(), 7);
-assert_eq!(NaiveDate::from_ymd(-308, 3, 14).day0(), 13);
-

fn ordinal(&self) -> u32[src]

Returns the day of year starting from 1.

-

The return value ranges from 1 to 366. (The last day of year differs by years.)

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).ordinal(), 251);
-assert_eq!(NaiveDate::from_ymd(-308, 3, 14).ordinal(), 74);
-

Combined with NaiveDate::pred, -one can determine the number of days in a particular year. -(Note that this panics when year is out of range.)

- -
-use chrono::{NaiveDate, Datelike};
-
-fn ndays_in_year(year: i32) -> u32 {
-    // the first day of the next year...
-    let d = NaiveDate::from_ymd(year + 1, 1, 1);
-
-    // ...is preceded by the last day of the original year
-    d.pred().ordinal()
-}
-
-assert_eq!(ndays_in_year(2015), 365);
-assert_eq!(ndays_in_year(2016), 366);
-assert_eq!(ndays_in_year(2017), 365);
-assert_eq!(ndays_in_year(2000), 366);
-assert_eq!(ndays_in_year(2100), 365);
-

fn ordinal0(&self) -> u32[src]

Returns the day of year starting from 0.

-

The return value ranges from 0 to 365. (The last day of year differs by years.)

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).ordinal0(), 250);
-assert_eq!(NaiveDate::from_ymd(-308, 3, 14).ordinal0(), 73);
-

fn weekday(&self) -> Weekday[src]

Returns the day of week.

-

Example

-
-use chrono::{NaiveDate, Datelike, Weekday};
-
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).weekday(), Weekday::Tue);
-assert_eq!(NaiveDate::from_ymd(-308, 3, 14).weekday(), Weekday::Fri);
-

fn with_year(&self, year: i32) -> Option<NaiveDate>[src]

Makes a new NaiveDate with the year number changed.

-

Returns None when the resulting NaiveDate would be invalid.

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_year(2016),
-           Some(NaiveDate::from_ymd(2016, 9, 8)));
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_year(-308),
-           Some(NaiveDate::from_ymd(-308, 9, 8)));
-

A leap day (February 29) is a good example that this method can return None.

- -
-assert!(NaiveDate::from_ymd(2016, 2, 29).with_year(2015).is_none());
-assert!(NaiveDate::from_ymd(2016, 2, 29).with_year(2020).is_some());
-

fn with_month(&self, month: u32) -> Option<NaiveDate>[src]

Makes a new NaiveDate with the month number (starting from 1) changed.

-

Returns None when the resulting NaiveDate would be invalid.

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_month(10),
-           Some(NaiveDate::from_ymd(2015, 10, 8)));
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_month(13), None); // no month 13
-assert_eq!(NaiveDate::from_ymd(2015, 9, 30).with_month(2), None); // no February 30
-

fn with_month0(&self, month0: u32) -> Option<NaiveDate>[src]

Makes a new NaiveDate with the month number (starting from 0) changed.

-

Returns None when the resulting NaiveDate would be invalid.

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_month0(9),
-           Some(NaiveDate::from_ymd(2015, 10, 8)));
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_month0(12), None); // no month 13
-assert_eq!(NaiveDate::from_ymd(2015, 9, 30).with_month0(1), None); // no February 30
-

fn with_day(&self, day: u32) -> Option<NaiveDate>[src]

Makes a new NaiveDate with the day of month (starting from 1) changed.

-

Returns None when the resulting NaiveDate would be invalid.

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_day(30),
-           Some(NaiveDate::from_ymd(2015, 9, 30)));
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_day(31),
-           None); // no September 31
-

fn with_day0(&self, day0: u32) -> Option<NaiveDate>[src]

Makes a new NaiveDate with the day of month (starting from 0) changed.

-

Returns None when the resulting NaiveDate would be invalid.

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_day0(29),
-           Some(NaiveDate::from_ymd(2015, 9, 30)));
-assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_day0(30),
-           None); // no September 31
-

fn with_ordinal(&self, ordinal: u32) -> Option<NaiveDate>[src]

Makes a new NaiveDate with the day of year (starting from 1) changed.

-

Returns None when the resulting NaiveDate would be invalid.

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(2015, 1, 1).with_ordinal(60),
-           Some(NaiveDate::from_ymd(2015, 3, 1)));
-assert_eq!(NaiveDate::from_ymd(2015, 1, 1).with_ordinal(366),
-           None); // 2015 had only 365 days
-
-assert_eq!(NaiveDate::from_ymd(2016, 1, 1).with_ordinal(60),
-           Some(NaiveDate::from_ymd(2016, 2, 29)));
-assert_eq!(NaiveDate::from_ymd(2016, 1, 1).with_ordinal(366),
-           Some(NaiveDate::from_ymd(2016, 12, 31)));
-

fn with_ordinal0(&self, ordinal0: u32) -> Option<NaiveDate>[src]

Makes a new NaiveDate with the day of year (starting from 0) changed.

-

Returns None when the resulting NaiveDate would be invalid.

-

Example

-
-use chrono::{NaiveDate, Datelike};
-
-assert_eq!(NaiveDate::from_ymd(2015, 1, 1).with_ordinal0(59),
-           Some(NaiveDate::from_ymd(2015, 3, 1)));
-assert_eq!(NaiveDate::from_ymd(2015, 1, 1).with_ordinal0(365),
-           None); // 2015 had only 365 days
-
-assert_eq!(NaiveDate::from_ymd(2016, 1, 1).with_ordinal0(59),
-           Some(NaiveDate::from_ymd(2016, 2, 29)));
-assert_eq!(NaiveDate::from_ymd(2016, 1, 1).with_ordinal0(365),
-           Some(NaiveDate::from_ymd(2016, 12, 31)));
-

impl Datelike for NaiveDateTime[src]

fn year(&self) -> i32[src]

Returns the year number in the calendar date.

-

See also the NaiveDate::year method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 25).and_hms(12, 34, 56);
-assert_eq!(dt.year(), 2015);
-

fn month(&self) -> u32[src]

Returns the month number starting from 1.

-

The return value ranges from 1 to 12.

-

See also the NaiveDate::month method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 25).and_hms(12, 34, 56);
-assert_eq!(dt.month(), 9);
-

fn month0(&self) -> u32[src]

Returns the month number starting from 0.

-

The return value ranges from 0 to 11.

-

See also the NaiveDate::month0 method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 25).and_hms(12, 34, 56);
-assert_eq!(dt.month0(), 8);
-

fn day(&self) -> u32[src]

Returns the day of month starting from 1.

-

The return value ranges from 1 to 31. (The last day of month differs by months.)

-

See also the NaiveDate::day method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 25).and_hms(12, 34, 56);
-assert_eq!(dt.day(), 25);
-

fn day0(&self) -> u32[src]

Returns the day of month starting from 0.

-

The return value ranges from 0 to 30. (The last day of month differs by months.)

-

See also the NaiveDate::day0 method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 25).and_hms(12, 34, 56);
-assert_eq!(dt.day0(), 24);
-

fn ordinal(&self) -> u32[src]

Returns the day of year starting from 1.

-

The return value ranges from 1 to 366. (The last day of year differs by years.)

-

See also the NaiveDate::ordinal method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 25).and_hms(12, 34, 56);
-assert_eq!(dt.ordinal(), 268);
-

fn ordinal0(&self) -> u32[src]

Returns the day of year starting from 0.

-

The return value ranges from 0 to 365. (The last day of year differs by years.)

-

See also the NaiveDate::ordinal0 method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 25).and_hms(12, 34, 56);
-assert_eq!(dt.ordinal0(), 267);
-

fn weekday(&self) -> Weekday[src]

Returns the day of week.

-

See also the NaiveDate::weekday method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike, Weekday};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 25).and_hms(12, 34, 56);
-assert_eq!(dt.weekday(), Weekday::Fri);
-

fn with_year(&self, year: i32) -> Option<NaiveDateTime>[src]

Makes a new NaiveDateTime with the year number changed.

-

Returns None when the resulting NaiveDateTime would be invalid.

-

See also the -NaiveDate::with_year method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 25).and_hms(12, 34, 56);
-assert_eq!(dt.with_year(2016), Some(NaiveDate::from_ymd(2016, 9, 25).and_hms(12, 34, 56)));
-assert_eq!(dt.with_year(-308), Some(NaiveDate::from_ymd(-308, 9, 25).and_hms(12, 34, 56)));
-

fn with_month(&self, month: u32) -> Option<NaiveDateTime>[src]

Makes a new NaiveDateTime with the month number (starting from 1) changed.

-

Returns None when the resulting NaiveDateTime would be invalid.

-

See also the -NaiveDate::with_month method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 30).and_hms(12, 34, 56);
-assert_eq!(dt.with_month(10), Some(NaiveDate::from_ymd(2015, 10, 30).and_hms(12, 34, 56)));
-assert_eq!(dt.with_month(13), None); // no month 13
-assert_eq!(dt.with_month(2), None); // no February 30
-

fn with_month0(&self, month0: u32) -> Option<NaiveDateTime>[src]

Makes a new NaiveDateTime with the month number (starting from 0) changed.

-

Returns None when the resulting NaiveDateTime would be invalid.

-

See also the -NaiveDate::with_month0 method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 30).and_hms(12, 34, 56);
-assert_eq!(dt.with_month0(9), Some(NaiveDate::from_ymd(2015, 10, 30).and_hms(12, 34, 56)));
-assert_eq!(dt.with_month0(12), None); // no month 13
-assert_eq!(dt.with_month0(1), None); // no February 30
-

fn with_day(&self, day: u32) -> Option<NaiveDateTime>[src]

Makes a new NaiveDateTime with the day of month (starting from 1) changed.

-

Returns None when the resulting NaiveDateTime would be invalid.

-

See also the -NaiveDate::with_day method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 8).and_hms(12, 34, 56);
-assert_eq!(dt.with_day(30), Some(NaiveDate::from_ymd(2015, 9, 30).and_hms(12, 34, 56)));
-assert_eq!(dt.with_day(31), None); // no September 31
-

fn with_day0(&self, day0: u32) -> Option<NaiveDateTime>[src]

Makes a new NaiveDateTime with the day of month (starting from 0) changed.

-

Returns None when the resulting NaiveDateTime would be invalid.

-

See also the -NaiveDate::with_day0 method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 8).and_hms(12, 34, 56);
-assert_eq!(dt.with_day0(29), Some(NaiveDate::from_ymd(2015, 9, 30).and_hms(12, 34, 56)));
-assert_eq!(dt.with_day0(30), None); // no September 31
-

fn with_ordinal(&self, ordinal: u32) -> Option<NaiveDateTime>[src]

Makes a new NaiveDateTime with the day of year (starting from 1) changed.

-

Returns None when the resulting NaiveDateTime would be invalid.

-

See also the -NaiveDate::with_ordinal method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 8).and_hms(12, 34, 56);
-assert_eq!(dt.with_ordinal(60),
-           Some(NaiveDate::from_ymd(2015, 3, 1).and_hms(12, 34, 56)));
-assert_eq!(dt.with_ordinal(366), None); // 2015 had only 365 days
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2016, 9, 8).and_hms(12, 34, 56);
-assert_eq!(dt.with_ordinal(60),
-           Some(NaiveDate::from_ymd(2016, 2, 29).and_hms(12, 34, 56)));
-assert_eq!(dt.with_ordinal(366),
-           Some(NaiveDate::from_ymd(2016, 12, 31).and_hms(12, 34, 56)));
-

fn with_ordinal0(&self, ordinal0: u32) -> Option<NaiveDateTime>[src]

Makes a new NaiveDateTime with the day of year (starting from 0) changed.

-

Returns None when the resulting NaiveDateTime would be invalid.

-

See also the -NaiveDate::with_ordinal0 method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Datelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 8).and_hms(12, 34, 56);
-assert_eq!(dt.with_ordinal0(59),
-           Some(NaiveDate::from_ymd(2015, 3, 1).and_hms(12, 34, 56)));
-assert_eq!(dt.with_ordinal0(365), None); // 2015 had only 365 days
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2016, 9, 8).and_hms(12, 34, 56);
-assert_eq!(dt.with_ordinal0(59),
-           Some(NaiveDate::from_ymd(2016, 2, 29).and_hms(12, 34, 56)));
-assert_eq!(dt.with_ordinal0(365),
-           Some(NaiveDate::from_ymd(2016, 12, 31).and_hms(12, 34, 56)));
-

impl<Tz: TimeZone> Datelike for Date<Tz>[src]

impl<Tz: TimeZone> Datelike for DateTime<Tz>[src]

Loading content...
\ No newline at end of file diff --git a/docs/chrono/trait.DurationRound.html b/docs/chrono/trait.DurationRound.html deleted file mode 100644 index 42a350bd..00000000 --- a/docs/chrono/trait.DurationRound.html +++ /dev/null @@ -1,39 +0,0 @@ -chrono::DurationRound - Rust - -

[][src]Trait chrono::DurationRound

pub trait DurationRound: Sized {
-    type Err: Error;
-    fn duration_round(self, duration: Duration) -> Result<Self, Self::Err>;
-
fn duration_trunc(self, duration: Duration) -> Result<Self, Self::Err>; -}

Extension trait for rounding or truncating a DateTime by a Duration.

-

Limitations

-

Both rounding and truncating are done via Duration::num_nanoseconds and -DateTime::timestamp_nanos. This means that they will fail if either the -Duration or the DateTime are too big to represented as nanoseconds. They -will also fail if the Duration is bigger than the timestamp.

-

Associated Types

type Err: Error[src]

Error that can occur in rounding or truncating

-
Loading content...

Required methods

fn duration_round(self, duration: Duration) -> Result<Self, Self::Err>[src]

Return a copy rounded by Duration.

-

Example

-
-let dt = Utc.ymd(2018, 1, 11).and_hms_milli(12, 0, 0, 154);
-assert_eq!(
-    dt.duration_round(Duration::milliseconds(10)).unwrap().to_string(),
-    "2018-01-11 12:00:00.150 UTC"
-);
-assert_eq!(
-    dt.duration_round(Duration::days(1)).unwrap().to_string(),
-    "2018-01-12 00:00:00 UTC"
-);
-

fn duration_trunc(self, duration: Duration) -> Result<Self, Self::Err>[src]

Return a copy truncated by Duration.

-

Example

-
-let dt = Utc.ymd(2018, 1, 11).and_hms_milli(12, 0, 0, 154);
-assert_eq!(
-    dt.duration_trunc(Duration::milliseconds(10)).unwrap().to_string(),
-    "2018-01-11 12:00:00.150 UTC"
-);
-assert_eq!(
-    dt.duration_trunc(Duration::days(1)).unwrap().to_string(),
-    "2018-01-11 00:00:00 UTC"
-);
-
Loading content...

Implementors

impl<Tz: TimeZone> DurationRound for DateTime<Tz>[src]

type Err = RoundingError

Loading content...
\ No newline at end of file diff --git a/docs/chrono/trait.SubsecRound.html b/docs/chrono/trait.SubsecRound.html deleted file mode 100644 index f3f1b4e9..00000000 --- a/docs/chrono/trait.SubsecRound.html +++ /dev/null @@ -1,28 +0,0 @@ -chrono::SubsecRound - Rust - -

[][src]Trait chrono::SubsecRound

pub trait SubsecRound {
-    fn round_subsecs(self, digits: u16) -> Self;
-
fn trunc_subsecs(self, digits: u16) -> Self; -}

Extension trait for subsecond rounding or truncation to a maximum number -of digits. Rounding can be used to decrease the error variance when -serializing/persisting to lower precision. Truncation is the default -behavior in Chrono display formatting. Either can be used to guarantee -equality (e.g. for testing) when round-tripping through a lower precision -format.

-

Required methods

fn round_subsecs(self, digits: u16) -> Self[src]

Return a copy rounded to the specified number of subsecond digits. With -9 or more digits, self is returned unmodified. Halfway values are -rounded up (away from zero).

-

Example

-
-let dt = Utc.ymd(2018, 1, 11).and_hms_milli(12, 0, 0, 154);
-assert_eq!(dt.round_subsecs(2).nanosecond(), 150_000_000);
-assert_eq!(dt.round_subsecs(1).nanosecond(), 200_000_000);
-

fn trunc_subsecs(self, digits: u16) -> Self[src]

Return a copy truncated to the specified number of subsecond -digits. With 9 or more digits, self is returned unmodified.

-

Example

-
-let dt = Utc.ymd(2018, 1, 11).and_hms_milli(12, 0, 0, 154);
-assert_eq!(dt.trunc_subsecs(2).nanosecond(), 150_000_000);
-assert_eq!(dt.trunc_subsecs(1).nanosecond(), 100_000_000);
-
Loading content...

Implementors

impl<T> SubsecRound for T where
    T: Timelike + Add<Duration, Output = T> + Sub<Duration, Output = T>, 
[src]

Loading content...
\ No newline at end of file diff --git a/docs/chrono/trait.Timelike.html b/docs/chrono/trait.Timelike.html deleted file mode 100644 index 8d5bf746..00000000 --- a/docs/chrono/trait.Timelike.html +++ /dev/null @@ -1,234 +0,0 @@ -chrono::Timelike - Rust - -

[][src]Trait chrono::Timelike

pub trait Timelike: Sized {
-    fn hour(&self) -> u32;
-
fn minute(&self) -> u32; -
fn second(&self) -> u32; -
fn nanosecond(&self) -> u32; -
fn with_hour(&self, hour: u32) -> Option<Self>; -
fn with_minute(&self, min: u32) -> Option<Self>; -
fn with_second(&self, sec: u32) -> Option<Self>; -
fn with_nanosecond(&self, nano: u32) -> Option<Self>; - - fn hour12(&self) -> (bool, u32) { ... } -
fn num_seconds_from_midnight(&self) -> u32 { ... } -}

The common set of methods for time component.

-

Required methods

fn hour(&self) -> u32[src]

Returns the hour number from 0 to 23.

-

fn minute(&self) -> u32[src]

Returns the minute number from 0 to 59.

-

fn second(&self) -> u32[src]

Returns the second number from 0 to 59.

-

fn nanosecond(&self) -> u32[src]

Returns the number of nanoseconds since the whole non-leap second. -The range from 1,000,000,000 to 1,999,999,999 represents -the leap second.

-

fn with_hour(&self, hour: u32) -> Option<Self>[src]

Makes a new value with the hour number changed.

-

Returns None when the resulting value would be invalid.

-

fn with_minute(&self, min: u32) -> Option<Self>[src]

Makes a new value with the minute number changed.

-

Returns None when the resulting value would be invalid.

-

fn with_second(&self, sec: u32) -> Option<Self>[src]

Makes a new value with the second number changed.

-

Returns None when the resulting value would be invalid. -As with the second method, -the input range is restricted to 0 through 59.

-

fn with_nanosecond(&self, nano: u32) -> Option<Self>[src]

Makes a new value with nanoseconds since the whole non-leap second changed.

-

Returns None when the resulting value would be invalid. -As with the nanosecond method, -the input range can exceed 1,000,000,000 for leap seconds.

-
Loading content...

Provided methods

fn hour12(&self) -> (bool, u32)[src]

Returns the hour number from 1 to 12 with a boolean flag, -which is false for AM and true for PM.

-

fn num_seconds_from_midnight(&self) -> u32[src]

Returns the number of non-leap seconds past the last midnight.

-
Loading content...

Implementors

impl Timelike for NaiveDateTime[src]

fn hour(&self) -> u32[src]

Returns the hour number from 0 to 23.

-

See also the NaiveTime::hour method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Timelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 8).and_hms_milli(12, 34, 56, 789);
-assert_eq!(dt.hour(), 12);
-

fn minute(&self) -> u32[src]

Returns the minute number from 0 to 59.

-

See also the NaiveTime::minute method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Timelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 8).and_hms_milli(12, 34, 56, 789);
-assert_eq!(dt.minute(), 34);
-

fn second(&self) -> u32[src]

Returns the second number from 0 to 59.

-

See also the NaiveTime::second method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Timelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 8).and_hms_milli(12, 34, 56, 789);
-assert_eq!(dt.second(), 56);
-

fn nanosecond(&self) -> u32[src]

Returns the number of nanoseconds since the whole non-leap second. -The range from 1,000,000,000 to 1,999,999,999 represents -the leap second.

-

See also the -NaiveTime::nanosecond method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Timelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 8).and_hms_milli(12, 34, 56, 789);
-assert_eq!(dt.nanosecond(), 789_000_000);
-

fn with_hour(&self, hour: u32) -> Option<NaiveDateTime>[src]

Makes a new NaiveDateTime with the hour number changed.

-

Returns None when the resulting NaiveDateTime would be invalid.

-

See also the -NaiveTime::with_hour method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Timelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 8).and_hms_milli(12, 34, 56, 789);
-assert_eq!(dt.with_hour(7),
-           Some(NaiveDate::from_ymd(2015, 9, 8).and_hms_milli(7, 34, 56, 789)));
-assert_eq!(dt.with_hour(24), None);
-

fn with_minute(&self, min: u32) -> Option<NaiveDateTime>[src]

Makes a new NaiveDateTime with the minute number changed.

-

Returns None when the resulting NaiveDateTime would be invalid.

-

See also the -NaiveTime::with_minute method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Timelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 8).and_hms_milli(12, 34, 56, 789);
-assert_eq!(dt.with_minute(45),
-           Some(NaiveDate::from_ymd(2015, 9, 8).and_hms_milli(12, 45, 56, 789)));
-assert_eq!(dt.with_minute(60), None);
-

fn with_second(&self, sec: u32) -> Option<NaiveDateTime>[src]

Makes a new NaiveDateTime with the second number changed.

-

Returns None when the resulting NaiveDateTime would be invalid. -As with the second method, -the input range is restricted to 0 through 59.

-

See also the -NaiveTime::with_second method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Timelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 8).and_hms_milli(12, 34, 56, 789);
-assert_eq!(dt.with_second(17),
-           Some(NaiveDate::from_ymd(2015, 9, 8).and_hms_milli(12, 34, 17, 789)));
-assert_eq!(dt.with_second(60), None);
-

fn with_nanosecond(&self, nano: u32) -> Option<NaiveDateTime>[src]

Makes a new NaiveDateTime with nanoseconds since the whole non-leap second changed.

-

Returns None when the resulting NaiveDateTime would be invalid. -As with the nanosecond method, -the input range can exceed 1,000,000,000 for leap seconds.

-

See also the -NaiveTime::with_nanosecond -method.

-

Example

-
-use chrono::{NaiveDate, NaiveDateTime, Timelike};
-
-let dt: NaiveDateTime = NaiveDate::from_ymd(2015, 9, 8).and_hms_milli(12, 34, 56, 789);
-assert_eq!(dt.with_nanosecond(333_333_333),
-           Some(NaiveDate::from_ymd(2015, 9, 8).and_hms_nano(12, 34, 56, 333_333_333)));
-assert_eq!(dt.with_nanosecond(1_333_333_333), // leap second
-           Some(NaiveDate::from_ymd(2015, 9, 8).and_hms_nano(12, 34, 56, 1_333_333_333)));
-assert_eq!(dt.with_nanosecond(2_000_000_000), None);
-

impl Timelike for NaiveTime[src]

fn hour(&self) -> u32[src]

Returns the hour number from 0 to 23.

-

Example

-
-use chrono::{NaiveTime, Timelike};
-
-assert_eq!(NaiveTime::from_hms(0, 0, 0).hour(), 0);
-assert_eq!(NaiveTime::from_hms_nano(23, 56, 4, 12_345_678).hour(), 23);
-

fn minute(&self) -> u32[src]

Returns the minute number from 0 to 59.

-

Example

-
-use chrono::{NaiveTime, Timelike};
-
-assert_eq!(NaiveTime::from_hms(0, 0, 0).minute(), 0);
-assert_eq!(NaiveTime::from_hms_nano(23, 56, 4, 12_345_678).minute(), 56);
-

fn second(&self) -> u32[src]

Returns the second number from 0 to 59.

-

Example

-
-use chrono::{NaiveTime, Timelike};
-
-assert_eq!(NaiveTime::from_hms(0, 0, 0).second(), 0);
-assert_eq!(NaiveTime::from_hms_nano(23, 56, 4, 12_345_678).second(), 4);
-

This method never returns 60 even when it is a leap second. -(Why?) -Use the proper formatting method to get a human-readable representation.

- -
-let leap = NaiveTime::from_hms_milli(23, 59, 59, 1_000);
-assert_eq!(leap.second(), 59);
-assert_eq!(leap.format("%H:%M:%S").to_string(), "23:59:60");
-

fn nanosecond(&self) -> u32[src]

Returns the number of nanoseconds since the whole non-leap second. -The range from 1,000,000,000 to 1,999,999,999 represents -the leap second.

-

Example

-
-use chrono::{NaiveTime, Timelike};
-
-assert_eq!(NaiveTime::from_hms(0, 0, 0).nanosecond(), 0);
-assert_eq!(NaiveTime::from_hms_nano(23, 56, 4, 12_345_678).nanosecond(), 12_345_678);
-

Leap seconds may have seemingly out-of-range return values. -You can reduce the range with time.nanosecond() % 1_000_000_000, or -use the proper formatting method to get a human-readable representation.

- -
-let leap = NaiveTime::from_hms_milli(23, 59, 59, 1_000);
-assert_eq!(leap.nanosecond(), 1_000_000_000);
-assert_eq!(leap.format("%H:%M:%S%.9f").to_string(), "23:59:60.000000000");
-

fn with_hour(&self, hour: u32) -> Option<NaiveTime>[src]

Makes a new NaiveTime with the hour number changed.

-

Returns None when the resulting NaiveTime would be invalid.

-

Example

-
-use chrono::{NaiveTime, Timelike};
-
-let dt = NaiveTime::from_hms_nano(23, 56, 4, 12_345_678);
-assert_eq!(dt.with_hour(7), Some(NaiveTime::from_hms_nano(7, 56, 4, 12_345_678)));
-assert_eq!(dt.with_hour(24), None);
-

fn with_minute(&self, min: u32) -> Option<NaiveTime>[src]

Makes a new NaiveTime with the minute number changed.

-

Returns None when the resulting NaiveTime would be invalid.

-

Example

-
-use chrono::{NaiveTime, Timelike};
-
-let dt = NaiveTime::from_hms_nano(23, 56, 4, 12_345_678);
-assert_eq!(dt.with_minute(45), Some(NaiveTime::from_hms_nano(23, 45, 4, 12_345_678)));
-assert_eq!(dt.with_minute(60), None);
-

fn with_second(&self, sec: u32) -> Option<NaiveTime>[src]

Makes a new NaiveTime with the second number changed.

-

Returns None when the resulting NaiveTime would be invalid. -As with the second method, -the input range is restricted to 0 through 59.

-

Example

-
-use chrono::{NaiveTime, Timelike};
-
-let dt = NaiveTime::from_hms_nano(23, 56, 4, 12_345_678);
-assert_eq!(dt.with_second(17), Some(NaiveTime::from_hms_nano(23, 56, 17, 12_345_678)));
-assert_eq!(dt.with_second(60), None);
-

fn with_nanosecond(&self, nano: u32) -> Option<NaiveTime>[src]

Makes a new NaiveTime with nanoseconds since the whole non-leap second changed.

-

Returns None when the resulting NaiveTime would be invalid. -As with the nanosecond method, -the input range can exceed 1,000,000,000 for leap seconds.

-

Example

-
-use chrono::{NaiveTime, Timelike};
-
-let dt = NaiveTime::from_hms_nano(23, 56, 4, 12_345_678);
-assert_eq!(dt.with_nanosecond(333_333_333),
-           Some(NaiveTime::from_hms_nano(23, 56, 4, 333_333_333)));
-assert_eq!(dt.with_nanosecond(2_000_000_000), None);
-

Leap seconds can theoretically follow any whole second. -The following would be a proper leap second at the time zone offset of UTC-00:03:57 -(there are several historical examples comparable to this "non-sense" offset), -and therefore is allowed.

- -
-assert_eq!(dt.with_nanosecond(1_333_333_333),
-           Some(NaiveTime::from_hms_nano(23, 56, 4, 1_333_333_333)));
-

fn num_seconds_from_midnight(&self) -> u32[src]

Returns the number of non-leap seconds past the last midnight.

-

Example

-
-use chrono::{NaiveTime, Timelike};
-
-assert_eq!(NaiveTime::from_hms(1, 2, 3).num_seconds_from_midnight(),
-           3723);
-assert_eq!(NaiveTime::from_hms_nano(23, 56, 4, 12_345_678).num_seconds_from_midnight(),
-           86164);
-assert_eq!(NaiveTime::from_hms_milli(23, 59, 59, 1_000).num_seconds_from_midnight(),
-           86399);
-

impl<Tz: TimeZone> Timelike for DateTime<Tz>[src]

Loading content...
\ No newline at end of file diff --git a/docs/http_body/all.html b/docs/http_body/all.html index f6246d2c..0e6df107 100644 --- a/docs/http_body/all.html +++ b/docs/http_body/all.html @@ -1,6 +1,6 @@ List of all items in this crate -

[][src]Constant libc::RENAME_NOREPLACE

pub const RENAME_NOREPLACE: c_uint = 1;
\ No newline at end of file diff --git a/docs/libc/constant.RENAME_WHITEOUT.html b/docs/libc/constant.RENAME_WHITEOUT.html index 71654339..4c758320 100644 --- a/docs/libc/constant.RENAME_WHITEOUT.html +++ b/docs/libc/constant.RENAME_WHITEOUT.html @@ -1,4 +1,4 @@ libc::RENAME_WHITEOUT - Rust

[][src]Constant libc::RENAME_WHITEOUT

pub const RENAME_WHITEOUT: c_int = 4;
\ No newline at end of file + Change settings

[][src]Constant libc::RENAME_WHITEOUT

pub const RENAME_WHITEOUT: c_uint = 4;
\ No newline at end of file diff --git a/docs/libc/constant.SYS_clone3.html b/docs/libc/constant.SYS_clone3.html index 87fa44c4..d729541d 100644 --- a/docs/libc/constant.SYS_clone3.html +++ b/docs/libc/constant.SYS_clone3.html @@ -1,4 +1,4 @@ libc::SYS_clone3 - Rust

[][src]Constant libc::SYS_clone3

pub const SYS_clone3: c_long = 435;
\ No newline at end of file + Change settings

[][src]Constant libc::SYS_clone3

pub const SYS_clone3: c_long = 435;
\ No newline at end of file diff --git a/docs/libc/constant.SYS_close_range.html b/docs/libc/constant.SYS_close_range.html new file mode 100644 index 00000000..51351a7e --- /dev/null +++ b/docs/libc/constant.SYS_close_range.html @@ -0,0 +1,4 @@ +libc::SYS_close_range - Rust + +

[][src]Constant libc::SYS_close_range

pub const SYS_close_range: c_long = 436;
\ No newline at end of file diff --git a/docs/libc/constant.SYS_epoll_pwait2.html b/docs/libc/constant.SYS_epoll_pwait2.html new file mode 100644 index 00000000..8faa94af --- /dev/null +++ b/docs/libc/constant.SYS_epoll_pwait2.html @@ -0,0 +1,4 @@ +libc::SYS_epoll_pwait2 - Rust + +

[][src]Constant libc::SYS_epoll_pwait2

pub const SYS_epoll_pwait2: c_long = 441;
\ No newline at end of file diff --git a/docs/libc/constant.SYS_faccessat2.html b/docs/libc/constant.SYS_faccessat2.html new file mode 100644 index 00000000..084ce79e --- /dev/null +++ b/docs/libc/constant.SYS_faccessat2.html @@ -0,0 +1,4 @@ +libc::SYS_faccessat2 - Rust + +

[][src]Constant libc::SYS_faccessat2

pub const SYS_faccessat2: c_long = 439;
\ No newline at end of file diff --git a/docs/libc/constant.SYS_fsconfig.html b/docs/libc/constant.SYS_fsconfig.html new file mode 100644 index 00000000..3718de39 --- /dev/null +++ b/docs/libc/constant.SYS_fsconfig.html @@ -0,0 +1,4 @@ +libc::SYS_fsconfig - Rust + +

[][src]Constant libc::SYS_fsconfig

pub const SYS_fsconfig: c_long = 431;
\ No newline at end of file diff --git a/docs/libc/constant.SYS_fsmount.html b/docs/libc/constant.SYS_fsmount.html new file mode 100644 index 00000000..70f7b7db --- /dev/null +++ b/docs/libc/constant.SYS_fsmount.html @@ -0,0 +1,4 @@ +libc::SYS_fsmount - Rust + +

[][src]Constant libc::SYS_fsmount

pub const SYS_fsmount: c_long = 432;
\ No newline at end of file diff --git a/docs/libc/constant.SYS_fsopen.html b/docs/libc/constant.SYS_fsopen.html new file mode 100644 index 00000000..8479bbb2 --- /dev/null +++ b/docs/libc/constant.SYS_fsopen.html @@ -0,0 +1,4 @@ +libc::SYS_fsopen - Rust + +

[][src]Constant libc::SYS_fsopen

pub const SYS_fsopen: c_long = 430;
\ No newline at end of file diff --git a/docs/libc/constant.SYS_fspick.html b/docs/libc/constant.SYS_fspick.html new file mode 100644 index 00000000..2995b281 --- /dev/null +++ b/docs/libc/constant.SYS_fspick.html @@ -0,0 +1,4 @@ +libc::SYS_fspick - Rust + +

[][src]Constant libc::SYS_fspick

pub const SYS_fspick: c_long = 433;
\ No newline at end of file diff --git a/docs/libc/constant.SYS_io_uring_enter.html b/docs/libc/constant.SYS_io_uring_enter.html new file mode 100644 index 00000000..5be56cd8 --- /dev/null +++ b/docs/libc/constant.SYS_io_uring_enter.html @@ -0,0 +1,4 @@ +libc::SYS_io_uring_enter - Rust + +

[][src]Constant libc::SYS_io_uring_enter

pub const SYS_io_uring_enter: c_long = 426;
\ No newline at end of file diff --git a/docs/libc/constant.SYS_io_uring_register.html b/docs/libc/constant.SYS_io_uring_register.html new file mode 100644 index 00000000..e8d35222 --- /dev/null +++ b/docs/libc/constant.SYS_io_uring_register.html @@ -0,0 +1,4 @@ +libc::SYS_io_uring_register - Rust + +

[][src]Constant libc::SYS_io_uring_register

pub const SYS_io_uring_register: c_long = 427;
\ No newline at end of file diff --git a/docs/libc/constant.SYS_io_uring_setup.html b/docs/libc/constant.SYS_io_uring_setup.html new file mode 100644 index 00000000..7089852a --- /dev/null +++ b/docs/libc/constant.SYS_io_uring_setup.html @@ -0,0 +1,4 @@ +libc::SYS_io_uring_setup - Rust + +

[][src]Constant libc::SYS_io_uring_setup

pub const SYS_io_uring_setup: c_long = 425;
\ No newline at end of file diff --git a/docs/libc/constant.SYS_mount_setattr.html b/docs/libc/constant.SYS_mount_setattr.html new file mode 100644 index 00000000..74f015d5 --- /dev/null +++ b/docs/libc/constant.SYS_mount_setattr.html @@ -0,0 +1,4 @@ +libc::SYS_mount_setattr - Rust + +

[][src]Constant libc::SYS_mount_setattr

pub const SYS_mount_setattr: c_long = 442;
\ No newline at end of file diff --git a/docs/libc/constant.SYS_move_mount.html b/docs/libc/constant.SYS_move_mount.html new file mode 100644 index 00000000..e5b6e06f --- /dev/null +++ b/docs/libc/constant.SYS_move_mount.html @@ -0,0 +1,4 @@ +libc::SYS_move_mount - Rust + +

[][src]Constant libc::SYS_move_mount

pub const SYS_move_mount: c_long = 429;
\ No newline at end of file diff --git a/docs/libc/constant.SYS_open_tree.html b/docs/libc/constant.SYS_open_tree.html new file mode 100644 index 00000000..97cc4d7a --- /dev/null +++ b/docs/libc/constant.SYS_open_tree.html @@ -0,0 +1,4 @@ +libc::SYS_open_tree - Rust + +

[][src]Constant libc::SYS_open_tree

pub const SYS_open_tree: c_long = 428;
\ No newline at end of file diff --git a/docs/libc/constant.SYS_openat2.html b/docs/libc/constant.SYS_openat2.html new file mode 100644 index 00000000..c7e6073c --- /dev/null +++ b/docs/libc/constant.SYS_openat2.html @@ -0,0 +1,4 @@ +libc::SYS_openat2 - Rust + +

[][src]Constant libc::SYS_openat2

pub const SYS_openat2: c_long = 437;
\ No newline at end of file diff --git a/docs/libc/constant.SYS_pidfd_getfd.html b/docs/libc/constant.SYS_pidfd_getfd.html new file mode 100644 index 00000000..ed74213b --- /dev/null +++ b/docs/libc/constant.SYS_pidfd_getfd.html @@ -0,0 +1,4 @@ +libc::SYS_pidfd_getfd - Rust + +

[][src]Constant libc::SYS_pidfd_getfd

pub const SYS_pidfd_getfd: c_long = 438;
\ No newline at end of file diff --git a/docs/libc/constant.SYS_pidfd_open.html b/docs/libc/constant.SYS_pidfd_open.html index 95dc8bd1..6e701e16 100644 --- a/docs/libc/constant.SYS_pidfd_open.html +++ b/docs/libc/constant.SYS_pidfd_open.html @@ -1,4 +1,4 @@ libc::SYS_pidfd_open - Rust

[][src]Constant libc::SYS_pidfd_open

pub const SYS_pidfd_open: c_long = 434;
\ No newline at end of file + Change settings

[][src]Constant libc::SYS_pidfd_open

pub const SYS_pidfd_open: c_long = 434;
\ No newline at end of file diff --git a/docs/libc/constant.SYS_pidfd_send_signal.html b/docs/libc/constant.SYS_pidfd_send_signal.html new file mode 100644 index 00000000..7352ddcb --- /dev/null +++ b/docs/libc/constant.SYS_pidfd_send_signal.html @@ -0,0 +1,4 @@ +libc::SYS_pidfd_send_signal - Rust + +

[][src]Constant libc::SYS_pidfd_send_signal

pub const SYS_pidfd_send_signal: c_long = 424;
\ No newline at end of file diff --git a/docs/libc/constant.SYS_process_madvise.html b/docs/libc/constant.SYS_process_madvise.html new file mode 100644 index 00000000..d47a9b89 --- /dev/null +++ b/docs/libc/constant.SYS_process_madvise.html @@ -0,0 +1,4 @@ +libc::SYS_process_madvise - Rust + +

[][src]Constant libc::SYS_process_madvise

pub const SYS_process_madvise: c_long = 440;
\ No newline at end of file diff --git a/docs/libc/fn.backtrace.html b/docs/libc/fn.backtrace.html index 2d0a14de..a6381b9d 100644 --- a/docs/libc/fn.backtrace.html +++ b/docs/libc/fn.backtrace.html @@ -1,4 +1,4 @@ libc::backtrace - Rust

[][src]Function libc::backtrace

pub unsafe extern "C" fn backtrace(buf: *mut *mut c_void, sz: c_int) -> c_int
\ No newline at end of file + Change settings

[][src]Function libc::backtrace

pub unsafe extern "C" fn backtrace(buf: *mut *mut c_void, sz: c_int) -> c_int
\ No newline at end of file diff --git a/docs/libc/fn.dlinfo.html b/docs/libc/fn.dlinfo.html index 4403f99c..5b16ccab 100644 --- a/docs/libc/fn.dlinfo.html +++ b/docs/libc/fn.dlinfo.html @@ -1,4 +1,4 @@ libc::dlinfo - Rust

[][src]Function libc::dlinfo

pub unsafe extern "C" fn dlinfo(
    handle: *mut c_void,
    request: c_int,
    info: *mut c_void
) -> c_int
\ No newline at end of file + Change settings

[][src]Function libc::dlinfo

pub unsafe extern "C" fn dlinfo(
    handle: *mut c_void,
    request: c_int,
    info: *mut c_void
) -> c_int
\ No newline at end of file diff --git a/docs/libc/fn.dlmopen.html b/docs/libc/fn.dlmopen.html index 59cae989..8abc85b4 100644 --- a/docs/libc/fn.dlmopen.html +++ b/docs/libc/fn.dlmopen.html @@ -1,4 +1,4 @@ libc::dlmopen - Rust

[][src]Function libc::dlmopen

pub unsafe extern "C" fn dlmopen(
    lmid: Lmid_t,
    filename: *const c_char,
    flag: c_int
) -> *mut c_void
\ No newline at end of file + Change settings

[][src]Function libc::dlmopen

pub unsafe extern "C" fn dlmopen(
    lmid: Lmid_t,
    filename: *const c_char,
    flag: c_int
) -> *mut c_void
\ No newline at end of file diff --git a/docs/libc/fn.getgrent_r.html b/docs/libc/fn.getgrent_r.html index 8dbb7878..0bff5bb5 100644 --- a/docs/libc/fn.getgrent_r.html +++ b/docs/libc/fn.getgrent_r.html @@ -1,4 +1,4 @@ libc::getgrent_r - Rust

[][src]Function libc::getgrent_r

pub unsafe extern "C" fn getgrent_r(
    grp: *mut group,
    buf: *mut c_char,
    buflen: size_t,
    result: *mut *mut group
) -> c_int
\ No newline at end of file + Change settings

[][src]Function libc::getgrent_r

pub unsafe extern "C" fn getgrent_r(
    grp: *mut group,
    buf: *mut c_char,
    buflen: size_t,
    result: *mut *mut group
) -> c_int
\ No newline at end of file diff --git a/docs/libc/fn.getpriority.html b/docs/libc/fn.getpriority.html index 0dde9379..1ed4f919 100644 --- a/docs/libc/fn.getpriority.html +++ b/docs/libc/fn.getpriority.html @@ -1,4 +1,4 @@ libc::getpriority - Rust

[][src]Function libc::getpriority

pub unsafe extern "C" fn getpriority(
    which: __priority_which_t,
    who: id_t
) -> c_int
\ No newline at end of file + Change settings

[][src]Function libc::getpriority

pub unsafe extern "C" fn getpriority(
    which: __priority_which_t,
    who: id_t
) -> c_int
\ No newline at end of file diff --git a/docs/libc/fn.getpwent_r.html b/docs/libc/fn.getpwent_r.html index 6f2af15f..9de8e497 100644 --- a/docs/libc/fn.getpwent_r.html +++ b/docs/libc/fn.getpwent_r.html @@ -1,4 +1,4 @@ libc::getpwent_r - Rust

[][src]Function libc::getpwent_r

pub unsafe extern "C" fn getpwent_r(
    pwd: *mut passwd,
    buf: *mut c_char,
    buflen: size_t,
    result: *mut *mut passwd
) -> c_int
\ No newline at end of file + Change settings

[][src]Function libc::getpwent_r

pub unsafe extern "C" fn getpwent_r(
    pwd: *mut passwd,
    buf: *mut c_char,
    buflen: size_t,
    result: *mut *mut passwd
) -> c_int
\ No newline at end of file diff --git a/docs/libc/fn.glob64.html b/docs/libc/fn.glob64.html index 430f14a7..6b4233ea 100644 --- a/docs/libc/fn.glob64.html +++ b/docs/libc/fn.glob64.html @@ -1,4 +1,4 @@ libc::glob64 - Rust

[][src]Function libc::glob64

pub unsafe extern "C" fn glob64(
    pattern: *const c_char,
    flags: c_int,
    errfunc: Option<extern "C" fn(epath: *const c_char, errno: c_int) -> c_int>,
    pglob: *mut glob64_t
) -> c_int
\ No newline at end of file + Change settings

[][src]Function libc::glob64

pub unsafe extern "C" fn glob64(
    pattern: *const c_char,
    flags: c_int,
    errfunc: Option<extern "C" fn(epath: *const c_char, errno: c_int) -> c_int>,
    pglob: *mut glob64_t
) -> c_int
\ No newline at end of file diff --git a/docs/libc/fn.globfree64.html b/docs/libc/fn.globfree64.html index 5a1802f9..5bca4b36 100644 --- a/docs/libc/fn.globfree64.html +++ b/docs/libc/fn.globfree64.html @@ -1,4 +1,4 @@ libc::globfree64 - Rust

[][src]Function libc::globfree64

pub unsafe extern "C" fn globfree64(pglob: *mut glob64_t)
\ No newline at end of file + Change settings

[][src]Function libc::globfree64

pub unsafe extern "C" fn globfree64(pglob: *mut glob64_t)
\ No newline at end of file diff --git a/docs/libc/fn.ioctl.html b/docs/libc/fn.ioctl.html index 5a9113b7..9314aa51 100644 --- a/docs/libc/fn.ioctl.html +++ b/docs/libc/fn.ioctl.html @@ -1,4 +1,4 @@ libc::ioctl - Rust

[][src]Function libc::ioctl

pub unsafe extern "C" fn ioctl(fd: c_int, request: c_ulong, ...) -> c_int
\ No newline at end of file + Change settings

[][src]Function libc::ioctl

pub unsafe extern "C" fn ioctl(fd: c_int, request: c_ulong, ...) -> c_int
\ No newline at end of file diff --git a/docs/libc/fn.mallinfo.html b/docs/libc/fn.mallinfo.html index 9f43f9ab..da34dd0d 100644 --- a/docs/libc/fn.mallinfo.html +++ b/docs/libc/fn.mallinfo.html @@ -1,4 +1,4 @@ libc::mallinfo - Rust

[][src]Function libc::mallinfo

pub unsafe extern "C" fn mallinfo() -> mallinfo
\ No newline at end of file + Change settings

[][src]Function libc::mallinfo

pub unsafe extern "C" fn mallinfo() -> mallinfo
\ No newline at end of file diff --git a/docs/libc/fn.malloc_usable_size.html b/docs/libc/fn.malloc_usable_size.html index a670f748..f91bf3d9 100644 --- a/docs/libc/fn.malloc_usable_size.html +++ b/docs/libc/fn.malloc_usable_size.html @@ -1,4 +1,4 @@ libc::malloc_usable_size - Rust

[][src]Function libc::malloc_usable_size

pub unsafe extern "C" fn malloc_usable_size(ptr: *mut c_void) -> size_t
\ No newline at end of file + Change settings

[][src]Function libc::malloc_usable_size

pub unsafe extern "C" fn malloc_usable_size(ptr: *mut c_void) -> size_t
\ No newline at end of file diff --git a/docs/libc/fn.pthread_attr_getaffinity_np.html b/docs/libc/fn.pthread_attr_getaffinity_np.html index 135f4159..ef39880f 100644 --- a/docs/libc/fn.pthread_attr_getaffinity_np.html +++ b/docs/libc/fn.pthread_attr_getaffinity_np.html @@ -1,4 +1,4 @@ libc::pthread_attr_getaffinity_np - Rust

[][src]Function libc::pthread_attr_getaffinity_np

pub unsafe extern "C" fn pthread_attr_getaffinity_np(
    attr: *const pthread_attr_t,
    cpusetsize: size_t,
    cpuset: *mut cpu_set_t
) -> c_int
\ No newline at end of file + Change settings

[][src]Function libc::pthread_attr_getaffinity_np

pub unsafe extern "C" fn pthread_attr_getaffinity_np(
    attr: *const pthread_attr_t,
    cpusetsize: size_t,
    cpuset: *mut cpu_set_t
) -> c_int
\ No newline at end of file diff --git a/docs/libc/fn.pthread_attr_setaffinity_np.html b/docs/libc/fn.pthread_attr_setaffinity_np.html index a79f8100..c6846616 100644 --- a/docs/libc/fn.pthread_attr_setaffinity_np.html +++ b/docs/libc/fn.pthread_attr_setaffinity_np.html @@ -1,4 +1,4 @@ libc::pthread_attr_setaffinity_np - Rust

[][src]Function libc::pthread_attr_setaffinity_np

pub unsafe extern "C" fn pthread_attr_setaffinity_np(
    attr: *mut pthread_attr_t,
    cpusetsize: size_t,
    cpuset: *const cpu_set_t
) -> c_int
\ No newline at end of file + Change settings

[][src]Function libc::pthread_attr_setaffinity_np

pub unsafe extern "C" fn pthread_attr_setaffinity_np(
    attr: *mut pthread_attr_t,
    cpusetsize: size_t,
    cpuset: *const cpu_set_t
) -> c_int
\ No newline at end of file diff --git a/docs/libc/fn.pthread_getaffinity_np.html b/docs/libc/fn.pthread_getaffinity_np.html index bd3cf3c3..90817efa 100644 --- a/docs/libc/fn.pthread_getaffinity_np.html +++ b/docs/libc/fn.pthread_getaffinity_np.html @@ -1,4 +1,4 @@ libc::pthread_getaffinity_np - Rust

[][src]Function libc::pthread_getaffinity_np

pub unsafe extern "C" fn pthread_getaffinity_np(
    thread: pthread_t,
    cpusetsize: size_t,
    cpuset: *mut cpu_set_t
) -> c_int
\ No newline at end of file + Change settings

[][src]Function libc::pthread_getaffinity_np

pub unsafe extern "C" fn pthread_getaffinity_np(
    thread: pthread_t,
    cpusetsize: size_t,
    cpuset: *mut cpu_set_t
) -> c_int
\ No newline at end of file diff --git a/docs/libc/fn.pthread_getname_np.html b/docs/libc/fn.pthread_getname_np.html index 1cb07e0d..dbb33edf 100644 --- a/docs/libc/fn.pthread_getname_np.html +++ b/docs/libc/fn.pthread_getname_np.html @@ -1,4 +1,4 @@ libc::pthread_getname_np - Rust

[][src]Function libc::pthread_getname_np

pub unsafe extern "C" fn pthread_getname_np(
    thread: pthread_t,
    name: *mut c_char,
    len: size_t
) -> c_int
\ No newline at end of file + Change settings

[][src]Function libc::pthread_getname_np

pub unsafe extern "C" fn pthread_getname_np(
    thread: pthread_t,
    name: *mut c_char,
    len: size_t
) -> c_int
\ No newline at end of file diff --git a/docs/libc/fn.pthread_rwlockattr_getkind_np.html b/docs/libc/fn.pthread_rwlockattr_getkind_np.html index d55e1b3d..1063817e 100644 --- a/docs/libc/fn.pthread_rwlockattr_getkind_np.html +++ b/docs/libc/fn.pthread_rwlockattr_getkind_np.html @@ -1,4 +1,4 @@ libc::pthread_rwlockattr_getkind_np - Rust

[][src]Function libc::pthread_rwlockattr_getkind_np

pub unsafe extern "C" fn pthread_rwlockattr_getkind_np(
    attr: *const pthread_rwlockattr_t,
    val: *mut c_int
) -> c_int
\ No newline at end of file + Change settings

[][src]Function libc::pthread_rwlockattr_getkind_np

pub unsafe extern "C" fn pthread_rwlockattr_getkind_np(
    attr: *const pthread_rwlockattr_t,
    val: *mut c_int
) -> c_int
\ No newline at end of file diff --git a/docs/libc/fn.pthread_rwlockattr_setkind_np.html b/docs/libc/fn.pthread_rwlockattr_setkind_np.html index 43e2bb2b..c2d7609d 100644 --- a/docs/libc/fn.pthread_rwlockattr_setkind_np.html +++ b/docs/libc/fn.pthread_rwlockattr_setkind_np.html @@ -1,4 +1,4 @@ libc::pthread_rwlockattr_setkind_np - Rust

[][src]Function libc::pthread_rwlockattr_setkind_np

pub unsafe extern "C" fn pthread_rwlockattr_setkind_np(
    attr: *mut pthread_rwlockattr_t,
    val: c_int
) -> c_int
\ No newline at end of file + Change settings

[][src]Function libc::pthread_rwlockattr_setkind_np

pub unsafe extern "C" fn pthread_rwlockattr_setkind_np(
    attr: *mut pthread_rwlockattr_t,
    val: c_int
) -> c_int
\ No newline at end of file diff --git a/docs/libc/fn.pthread_setaffinity_np.html b/docs/libc/fn.pthread_setaffinity_np.html index 1630be28..3bb00fb9 100644 --- a/docs/libc/fn.pthread_setaffinity_np.html +++ b/docs/libc/fn.pthread_setaffinity_np.html @@ -1,4 +1,4 @@ libc::pthread_setaffinity_np - Rust

[][src]Function libc::pthread_setaffinity_np

pub unsafe extern "C" fn pthread_setaffinity_np(
    thread: pthread_t,
    cpusetsize: size_t,
    cpuset: *const cpu_set_t
) -> c_int
\ No newline at end of file + Change settings

[][src]Function libc::pthread_setaffinity_np

pub unsafe extern "C" fn pthread_setaffinity_np(
    thread: pthread_t,
    cpusetsize: size_t,
    cpuset: *const cpu_set_t
) -> c_int
\ No newline at end of file diff --git a/docs/libc/fn.pthread_setname_np.html b/docs/libc/fn.pthread_setname_np.html index ea05bc95..8beef7de 100644 --- a/docs/libc/fn.pthread_setname_np.html +++ b/docs/libc/fn.pthread_setname_np.html @@ -1,4 +1,4 @@ libc::pthread_setname_np - Rust

[][src]Function libc::pthread_setname_np

pub unsafe extern "C" fn pthread_setname_np(
    thread: pthread_t,
    name: *const c_char
) -> c_int
\ No newline at end of file + Change settings

[][src]Function libc::pthread_setname_np

pub unsafe extern "C" fn pthread_setname_np(
    thread: pthread_t,
    name: *const c_char
) -> c_int
\ No newline at end of file diff --git a/docs/libc/fn.ptrace.html b/docs/libc/fn.ptrace.html index c1c3f86c..ab718f12 100644 --- a/docs/libc/fn.ptrace.html +++ b/docs/libc/fn.ptrace.html @@ -1,4 +1,4 @@ libc::ptrace - Rust

[][src]Function libc::ptrace

pub unsafe extern "C" fn ptrace(request: c_uint, ...) -> c_long
\ No newline at end of file + Change settings

[][src]Function libc::ptrace

pub unsafe extern "C" fn ptrace(request: c_uint, ...) -> c_long
\ No newline at end of file diff --git a/docs/libc/fn.renameat2.html b/docs/libc/fn.renameat2.html new file mode 100644 index 00000000..817c44c6 --- /dev/null +++ b/docs/libc/fn.renameat2.html @@ -0,0 +1,4 @@ +libc::renameat2 - Rust + +

[][src]Function libc::renameat2

pub unsafe extern "C" fn renameat2(
    olddirfd: c_int,
    oldpath: *const c_char,
    newdirfd: c_int,
    newpath: *const c_char,
    flags: c_uint
) -> c_int
\ No newline at end of file diff --git a/docs/libc/fn.sched_getcpu.html b/docs/libc/fn.sched_getcpu.html index 1b814285..1c79c875 100644 --- a/docs/libc/fn.sched_getcpu.html +++ b/docs/libc/fn.sched_getcpu.html @@ -1,4 +1,4 @@ libc::sched_getcpu - Rust

[][src]Function libc::sched_getcpu

pub unsafe extern "C" fn sched_getcpu() -> c_int
\ No newline at end of file + Change settings

[][src]Function libc::sched_getcpu

pub unsafe extern "C" fn sched_getcpu() -> c_int
\ No newline at end of file diff --git a/docs/libc/fn.setpriority.html b/docs/libc/fn.setpriority.html index 636b27ba..b1398e17 100644 --- a/docs/libc/fn.setpriority.html +++ b/docs/libc/fn.setpriority.html @@ -1,4 +1,4 @@ libc::setpriority - Rust

[][src]Function libc::setpriority

pub unsafe extern "C" fn setpriority(
    which: __priority_which_t,
    who: id_t,
    prio: c_int
) -> c_int
\ No newline at end of file + Change settings

[][src]Function libc::setpriority

pub unsafe extern "C" fn setpriority(
    which: __priority_which_t,
    who: id_t,
    prio: c_int
) -> c_int
\ No newline at end of file diff --git a/docs/libc/fn.sysctl.html b/docs/libc/fn.sysctl.html index 4a5e4a7d..a7c1238c 100644 --- a/docs/libc/fn.sysctl.html +++ b/docs/libc/fn.sysctl.html @@ -1,4 +1,4 @@ libc::sysctl - Rust

[][src]Function libc::sysctl

pub unsafe extern "C" fn sysctl(
    name: *mut c_int,
    namelen: c_int,
    oldp: *mut c_void,
    oldlenp: *mut size_t,
    newp: *mut c_void,
    newlen: size_t
) -> c_int
\ No newline at end of file + Change settings

[][src]Function libc::sysctl

pub unsafe extern "C" fn sysctl(
    name: *mut c_int,
    namelen: c_int,
    oldp: *mut c_void,
    oldlenp: *mut size_t,
    newp: *mut c_void,
    newlen: size_t
) -> c_int
\ No newline at end of file diff --git a/docs/libc/index.html b/docs/libc/index.html index 31331921..e7313cdb 100644 --- a/docs/libc/index.html +++ b/docs/libc/index.html @@ -1,6 +1,6 @@ libc - Rust -

[][src]Enum rapr::Error

pub enum Error {
     UnexpectedJson,
     NoneError,
     JsonParseError(Error),
@@ -9,14 +9,14 @@
 }

Error enum

Variants

-
UnexpectedJson
NoneError
JsonParseError(Error)
RequestError(Error)

Trait Implementations

impl Debug for Error[src]

impl Display for Error[src]

impl Error for Error[src]