[go: up one dir, main page]

Duration

Struct Duration 

Source
pub struct Duration { /* private fields */ }
Available on crate feature chrono only.
Expand description

ISO 8601 time duration with nanosecond precision.

This also allows for the negative duration; see individual methods for details.

Implementations§

Source§

impl Duration

Source

pub fn weeks(weeks: i64) -> Duration

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.

Source

pub fn try_weeks(weeks: i64) -> Option<Duration>

Makes a new Duration with given number of weeks. Equivalent to Duration::seconds(weeks * 7 * 24 * 60 * 60) with overflow checks. Returns None when the duration is out of bounds.

Source

pub fn days(days: i64) -> Duration

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.

Source

pub fn try_days(days: i64) -> Option<Duration>

Makes a new Duration with given number of days. Equivalent to Duration::seconds(days * 24 * 60 * 60) with overflow checks. Returns None when the duration is out of bounds.

Source

pub fn hours(hours: i64) -> Duration

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.

Source

pub fn try_hours(hours: i64) -> Option<Duration>

Makes a new Duration with given number of hours. Equivalent to Duration::seconds(hours * 60 * 60) with overflow checks. Returns None when the duration is out of bounds.

Source

pub fn minutes(minutes: i64) -> Duration

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.

Source

pub fn try_minutes(minutes: i64) -> Option<Duration>

Makes a new Duration with given number of minutes. Equivalent to Duration::seconds(minutes * 60) with overflow checks. Returns None when the duration is out of bounds.

Source

pub fn seconds(seconds: i64) -> Duration

Makes a new Duration with given number of seconds. Panics when the duration is more than i64::MAX milliseconds or less than -i64::MAX milliseconds.

Source

pub fn try_seconds(seconds: i64) -> Option<Duration>

Makes a new Duration with given number of seconds. Returns None when the duration is more than i64::MAX milliseconds or less than -i64::MAX milliseconds.

Source

pub const fn milliseconds(milliseconds: i64) -> Duration

Makes a new Duration with given number of milliseconds.

Source

pub const fn microseconds(microseconds: i64) -> Duration

Makes a new Duration with given number of microseconds.

Source

pub const fn nanoseconds(nanos: i64) -> Duration

Makes a new Duration with given number of nanoseconds.

Source

pub const fn num_weeks(&self) -> i64

Returns the total number of whole weeks in the duration.

Source

pub const fn num_days(&self) -> i64

Returns the total number of whole days in the duration.

Source

pub const fn num_hours(&self) -> i64

Returns the total number of whole hours in the duration.

Source

pub const fn num_minutes(&self) -> i64

Returns the total number of whole minutes in the duration.

Source

pub const fn num_seconds(&self) -> i64

Returns the total number of whole seconds in the duration.

Source

pub const fn subsec_nanos(&self) -> i32

Returns the number of nanoseconds such that subsec_nanos() + num_seconds() * NANOS_PER_SEC is the total number of nanoseconds in the duration.

Source

pub const fn num_milliseconds(&self) -> i64

Returns the total number of whole milliseconds in the duration,

Source

pub const fn num_microseconds(&self) -> Option<i64>

Returns the total number of whole microseconds in the duration, or None on overflow (exceeding 2^63 microseconds in either direction).

Source

pub const fn num_nanoseconds(&self) -> Option<i64>

Returns the total number of whole nanoseconds in the duration, or None on overflow (exceeding 2^63 nanoseconds in either direction).

Source

pub fn checked_add(&self, rhs: &Duration) -> Option<Duration>

Add two durations, returning None if overflow occurred.

Source

pub fn checked_sub(&self, rhs: &Duration) -> Option<Duration>

Subtract two durations, returning None if overflow occurred.

Source

pub const fn abs(&self) -> Duration

Returns the duration as an absolute (non-negative) value.

Source

pub const fn min_value() -> Duration

The minimum possible Duration: -i64::MAX milliseconds.

Source

pub const fn max_value() -> Duration

The maximum possible Duration: i64::MAX milliseconds.

Source

pub const fn zero() -> Duration

A duration where the stored seconds and nanoseconds are equal to zero.

Source

pub const fn is_zero(&self) -> bool

Returns true if the duration equals Duration::zero().

Source

pub fn from_std(duration: Duration) -> Result<Duration, OutOfRangeError>

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.

Source

pub fn to_std(&self) -> Result<Duration, OutOfRangeError>

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§

Source§

impl<Tz> Add<Duration> for Date<Tz>
where Tz: TimeZone,

Source§

type Output = Date<Tz>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Duration) -> Date<Tz>

Performs the + operation. Read more
Source§

impl<Tz> Add<Duration> for DateTime<Tz>
where Tz: TimeZone,

Add chrono::Duration to DateTime.

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

Panics if the resulting date would be out of range. Consider using DateTime<Tz>::checked_add_signed to get an Option instead.

Source§

type Output = DateTime<Tz>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Duration) -> DateTime<Tz>

Performs the + operation. Read more
Source§

impl Add<Duration> for NaiveDate

Add chrono::Duration to NaiveDate.

This discards the fractional days in Duration, rounding to the closest integral number of days towards Duration::zero().

§Panics

Panics if the resulting date would be out of range. Consider using NaiveDate::checked_add_signed to get an Option instead.

§Example

use chrono::{Duration, NaiveDate};

let from_ymd = |y, m, d| NaiveDate::from_ymd_opt(y, m, d).unwrap();

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));
Source§

type Output = NaiveDate

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Duration) -> NaiveDate

Performs the + operation. Read more
Source§

impl Add<Duration> for NaiveDateTime

Add chrono::Duration to 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

Panics if the resulting date would be out of range. Consider using NaiveDateTime::checked_add_signed to get an Option instead.

§Example

use chrono::{Duration, NaiveDate};

let from_ymd = |y, m, d| NaiveDate::from_ymd_opt(y, m, d).unwrap();

let d = from_ymd(2016, 7, 8);
let hms = |h, m, s| d.and_hms_opt(h, m, s).unwrap();
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_opt(3, 5, 7).unwrap());
assert_eq!(hms(3, 5, 7) + Duration::days(365),
           from_ymd(2017, 7, 8).and_hms_opt(3, 5, 7).unwrap());

let hmsm = |h, m, s, milli| d.and_hms_milli_opt(h, m, s, milli).unwrap();
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_opt(3, 5, 59, 300).unwrap());
Source§

type Output = NaiveDateTime

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Duration) -> NaiveDateTime

Performs the + operation. Read more
Source§

impl Add<Duration> for NaiveTime

Add chrono::Duration to NaiveTime.

This 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 = |h, m, s, milli| { NaiveTime::from_hms_milli_opt(h, m, s, milli).unwrap() };

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));
Source§

type Output = NaiveTime

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Duration) -> NaiveTime

Performs the + operation. Read more
Source§

impl Add for Duration

Source§

type Output = Duration

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Duration) -> Duration

Performs the + operation. Read more
Source§

impl<Tz> AddAssign<Duration> for Date<Tz>
where Tz: TimeZone,

Source§

fn add_assign(&mut self, rhs: Duration)

Performs the += operation. Read more
Source§

impl<Tz> AddAssign<Duration> for DateTime<Tz>
where Tz: TimeZone,

Add-assign chrono::Duration to DateTime.

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

Panics if the resulting date would be out of range. Consider using DateTime<Tz>::checked_add_signed to get an Option instead.

Source§

fn add_assign(&mut self, rhs: Duration)

Performs the += operation. Read more
Source§

impl AddAssign<Duration> for NaiveDate

Add-assign of chrono::Duration to NaiveDate.

This discards the fractional days in Duration, rounding to the closest integral number of days towards Duration::zero().

§Panics

Panics if the resulting date would be out of range. Consider using NaiveDate::checked_add_signed to get an Option instead.

Source§

fn add_assign(&mut self, rhs: Duration)

Performs the += operation. Read more
Source§

impl AddAssign<Duration> for NaiveDateTime

Add-assign chrono::Duration to 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

Panics if the resulting date would be out of range. Consider using NaiveDateTime::checked_add_signed to get an Option instead.

Source§

fn add_assign(&mut self, rhs: Duration)

Performs the += operation. Read more
Source§

impl AddAssign<Duration> for NaiveTime

Add-assign chrono::Duration to NaiveTime.

This wraps around and never overflows or underflows. In particular the addition ignores integral number of days.

Source§

fn add_assign(&mut self, rhs: Duration)

Performs the += operation. Read more
Source§

impl AddAssign for Duration

Source§

fn add_assign(&mut self, rhs: Duration)

Performs the += operation. Read more
Source§

impl Clone for Duration

Source§

fn clone(&self) -> Duration

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Duration

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for Duration

Source§

fn default() -> Duration

Returns the “default value” for a type. Read more
Source§

impl<'de, FORMAT> DeserializeAs<'de, Duration> for DurationMicroSeconds<FORMAT, Flexible>
where FORMAT: Format,

Available on crate feature chrono_0_4 only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<'de> DeserializeAs<'de, Duration> for DurationMicroSeconds<String, Strict>

Available on crate feature chrono_0_4 only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<'de> DeserializeAs<'de, Duration> for DurationMicroSeconds<f64, Strict>

Available on crate feature chrono_0_4 only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<'de> DeserializeAs<'de, Duration> for DurationMicroSeconds<i64, Strict>

Available on crate feature chrono_0_4 only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<'de> DeserializeAs<'de, Duration> for DurationMicroSecondsWithFrac<f64, Strict>

Available on crate feature chrono_0_4 only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<'de, FORMAT> DeserializeAs<'de, Duration> for DurationMicroSecondsWithFrac<FORMAT, Flexible>
where FORMAT: Format,

Available on crate feature chrono_0_4 only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<'de> DeserializeAs<'de, Duration> for DurationMicroSecondsWithFrac<String, Strict>

Available on crate feature chrono_0_4 only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<'de, FORMAT> DeserializeAs<'de, Duration> for DurationMilliSeconds<FORMAT, Flexible>
where FORMAT: Format,

Available on crate feature chrono_0_4 only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<'de> DeserializeAs<'de, Duration> for DurationMilliSeconds<String, Strict>

Available on crate feature chrono_0_4 only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<'de> DeserializeAs<'de, Duration> for DurationMilliSeconds<f64, Strict>

Available on crate feature chrono_0_4 only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<'de> DeserializeAs<'de, Duration> for DurationMilliSeconds<i64, Strict>

Available on crate feature chrono_0_4 only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<'de> DeserializeAs<'de, Duration> for DurationMilliSecondsWithFrac<f64, Strict>

Available on crate feature chrono_0_4 only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<'de, FORMAT> DeserializeAs<'de, Duration> for DurationMilliSecondsWithFrac<FORMAT, Flexible>
where FORMAT: Format,

Available on crate feature chrono_0_4 only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<'de> DeserializeAs<'de, Duration> for DurationMilliSecondsWithFrac<String, Strict>

Available on crate feature chrono_0_4 only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<'de, FORMAT> DeserializeAs<'de, Duration> for DurationNanoSeconds<FORMAT, Flexible>
where FORMAT: Format,

Available on crate feature chrono_0_4 only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<'de> DeserializeAs<'de, Duration> for DurationNanoSeconds<String, Strict>

Available on crate feature chrono_0_4 only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<'de> DeserializeAs<'de, Duration> for DurationNanoSeconds<f64, Strict>

Available on crate feature chrono_0_4 only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<'de> DeserializeAs<'de, Duration> for DurationNanoSeconds<i64, Strict>

Available on crate feature chrono_0_4 only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<'de> DeserializeAs<'de, Duration> for DurationNanoSecondsWithFrac<f64, Strict>

Available on crate feature chrono_0_4 only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<'de, FORMAT> DeserializeAs<'de, Duration> for DurationNanoSecondsWithFrac<FORMAT, Flexible>
where FORMAT: Format,

Available on crate feature chrono_0_4 only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<'de> DeserializeAs<'de, Duration> for DurationNanoSecondsWithFrac<String, Strict>

Available on crate feature chrono_0_4 only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<'de, FORMAT> DeserializeAs<'de, Duration> for DurationSeconds<FORMAT, Flexible>
where FORMAT: Format,

Available on crate feature chrono_0_4 only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<'de> DeserializeAs<'de, Duration> for DurationSeconds<String, Strict>

Available on crate feature chrono_0_4 only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<'de> DeserializeAs<'de, Duration> for DurationSeconds<f64, Strict>

Available on crate feature chrono_0_4 only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<'de> DeserializeAs<'de, Duration> for DurationSeconds<i64, Strict>

Available on crate feature chrono_0_4 only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<'de> DeserializeAs<'de, Duration> for DurationSecondsWithFrac<f64, Strict>

Available on crate feature chrono_0_4 only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<'de, FORMAT> DeserializeAs<'de, Duration> for DurationSecondsWithFrac<FORMAT, Flexible>
where FORMAT: Format,

Available on crate feature chrono_0_4 only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<'de> DeserializeAs<'de, Duration> for DurationSecondsWithFrac<String, Strict>

Available on crate feature chrono_0_4 only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl Display for Duration

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Format a duration using the ISO 8601 format

Source§

impl Div<i32> for Duration

Source§

type Output = Duration

The resulting type after applying the / operator.
Source§

fn div(self, rhs: i32) -> Duration

Performs the / operation. Read more
Source§

impl Hash for Duration

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Mul<i32> for Duration

Source§

type Output = Duration

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: i32) -> Duration

Performs the * operation. Read more
Source§

impl Neg for Duration

Source§

type Output = Duration

The resulting type after applying the - operator.
Source§

fn neg(self) -> Duration

Performs the unary - operation. Read more
Source§

impl Ord for Duration

Source§

fn cmp(&self, other: &Duration) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Duration

Source§

fn eq(&self, other: &Duration) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Duration

Source§

fn partial_cmp(&self, other: &Duration) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<STRICTNESS> SerializeAs<Duration> for DurationMicroSeconds<String, STRICTNESS>
where STRICTNESS: Strictness,

Available on crate feature chrono_0_4 only.
Source§

fn serialize_as<S>(source: &Duration, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer.
Source§

impl<STRICTNESS> SerializeAs<Duration> for DurationMicroSeconds<f64, STRICTNESS>
where STRICTNESS: Strictness,

Available on crate feature chrono_0_4 only.
Source§

fn serialize_as<S>(source: &Duration, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer.
Source§

impl<STRICTNESS> SerializeAs<Duration> for DurationMicroSeconds<i64, STRICTNESS>
where STRICTNESS: Strictness,

Available on crate feature chrono_0_4 only.
Source§

fn serialize_as<S>(source: &Duration, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer.
Source§

impl<STRICTNESS> SerializeAs<Duration> for DurationMicroSecondsWithFrac<String, STRICTNESS>
where STRICTNESS: Strictness,

Available on crate feature chrono_0_4 only.
Source§

fn serialize_as<S>(source: &Duration, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer.
Source§

impl<STRICTNESS> SerializeAs<Duration> for DurationMicroSecondsWithFrac<f64, STRICTNESS>
where STRICTNESS: Strictness,

Available on crate feature chrono_0_4 only.
Source§

fn serialize_as<S>(source: &Duration, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer.
Source§

impl<STRICTNESS> SerializeAs<Duration> for DurationMilliSeconds<String, STRICTNESS>
where STRICTNESS: Strictness,

Available on crate feature chrono_0_4 only.
Source§

fn serialize_as<S>(source: &Duration, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer.
Source§

impl<STRICTNESS> SerializeAs<Duration> for DurationMilliSeconds<f64, STRICTNESS>
where STRICTNESS: Strictness,

Available on crate feature chrono_0_4 only.
Source§

fn serialize_as<S>(source: &Duration, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer.
Source§

impl<STRICTNESS> SerializeAs<Duration> for DurationMilliSeconds<i64, STRICTNESS>
where STRICTNESS: Strictness,

Available on crate feature chrono_0_4 only.
Source§

fn serialize_as<S>(source: &Duration, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer.
Source§

impl<STRICTNESS> SerializeAs<Duration> for DurationMilliSecondsWithFrac<String, STRICTNESS>
where STRICTNESS: Strictness,

Available on crate feature chrono_0_4 only.
Source§

fn serialize_as<S>(source: &Duration, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer.
Source§

impl<STRICTNESS> SerializeAs<Duration> for DurationMilliSecondsWithFrac<f64, STRICTNESS>
where STRICTNESS: Strictness,

Available on crate feature chrono_0_4 only.
Source§

fn serialize_as<S>(source: &Duration, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer.
Source§

impl<STRICTNESS> SerializeAs<Duration> for DurationNanoSeconds<String, STRICTNESS>
where STRICTNESS: Strictness,

Available on crate feature chrono_0_4 only.
Source§

fn serialize_as<S>(source: &Duration, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer.
Source§

impl<STRICTNESS> SerializeAs<Duration> for DurationNanoSeconds<f64, STRICTNESS>
where STRICTNESS: Strictness,

Available on crate feature chrono_0_4 only.
Source§

fn serialize_as<S>(source: &Duration, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer.
Source§

impl<STRICTNESS> SerializeAs<Duration> for DurationNanoSeconds<i64, STRICTNESS>
where STRICTNESS: Strictness,

Available on crate feature chrono_0_4 only.
Source§

fn serialize_as<S>(source: &Duration, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer.
Source§

impl<STRICTNESS> SerializeAs<Duration> for DurationNanoSecondsWithFrac<String, STRICTNESS>
where STRICTNESS: Strictness,

Available on crate feature chrono_0_4 only.
Source§

fn serialize_as<S>(source: &Duration, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer.
Source§

impl<STRICTNESS> SerializeAs<Duration> for DurationNanoSecondsWithFrac<f64, STRICTNESS>
where STRICTNESS: Strictness,

Available on crate feature chrono_0_4 only.
Source§

fn serialize_as<S>(source: &Duration, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer.
Source§

impl<STRICTNESS> SerializeAs<Duration> for DurationSeconds<String, STRICTNESS>
where STRICTNESS: Strictness,

Available on crate feature chrono_0_4 only.
Source§

fn serialize_as<S>(source: &Duration, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer.
Source§

impl<STRICTNESS> SerializeAs<Duration> for DurationSeconds<f64, STRICTNESS>
where STRICTNESS: Strictness,

Available on crate feature chrono_0_4 only.
Source§

fn serialize_as<S>(source: &Duration, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer.
Source§

impl<STRICTNESS> SerializeAs<Duration> for DurationSeconds<i64, STRICTNESS>
where STRICTNESS: Strictness,

Available on crate feature chrono_0_4 only.
Source§

fn serialize_as<S>(source: &Duration, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer.
Source§

impl<STRICTNESS> SerializeAs<Duration> for DurationSecondsWithFrac<String, STRICTNESS>
where STRICTNESS: Strictness,

Available on crate feature chrono_0_4 only.
Source§

fn serialize_as<S>(source: &Duration, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer.
Source§

impl<STRICTNESS> SerializeAs<Duration> for DurationSecondsWithFrac<f64, STRICTNESS>
where STRICTNESS: Strictness,

Available on crate feature chrono_0_4 only.
Source§

fn serialize_as<S>(source: &Duration, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer.
Source§

impl<Tz> Sub<Duration> for Date<Tz>
where Tz: TimeZone,

Source§

type Output = Date<Tz>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Duration) -> Date<Tz>

Performs the - operation. Read more
Source§

impl<Tz> Sub<Duration> for DateTime<Tz>
where Tz: TimeZone,

Subtract chrono::Duration from DateTime.

This is the same as the addition with a negated Duration.

As a part of Chrono’s [leap second handling] the subtraction assumes that there is no leap second ever, except when the DateTime itself represents a leap second in which case the assumption becomes that there is exactly a single leap second ever.

§Panics

Panics if the resulting date would be out of range. Consider using DateTime<Tz>::checked_sub_signed to get an Option instead.

Source§

type Output = DateTime<Tz>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Duration) -> DateTime<Tz>

Performs the - operation. Read more
Source§

impl Sub<Duration> for NaiveDate

Subtract chrono::Duration from NaiveDate.

This discards the fractional days in Duration, rounding to the closest integral number of days towards Duration::zero(). It is the same as the addition with a negated Duration.

§Panics

Panics if the resulting date would be out of range. Consider using NaiveDate::checked_sub_signed to get an Option instead.

§Example

use chrono::{Duration, NaiveDate};

let from_ymd = |y, m, d| NaiveDate::from_ymd_opt(y, m, d).unwrap();

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));
Source§

type Output = NaiveDate

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Duration) -> NaiveDate

Performs the - operation. Read more
Source§

impl Sub<Duration> for NaiveDateTime

Subtract chrono::Duration from NaiveDateTime.

This is the same as the addition with a negated Duration.

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.

§Panics

Panics if the resulting date would be out of range. Consider using NaiveDateTime::checked_sub_signed to get an Option instead.

§Example

use chrono::{Duration, NaiveDate};

let from_ymd = |y, m, d| NaiveDate::from_ymd_opt(y, m, d).unwrap();

let d = from_ymd(2016, 7, 8);
let hms = |h, m, s| d.and_hms_opt(h, m, s).unwrap();
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_opt(3, 5, 7).unwrap());
assert_eq!(hms(3, 5, 7) - Duration::days(365),
           from_ymd(2015, 7, 9).and_hms_opt(3, 5, 7).unwrap());

let hmsm = |h, m, s, milli| d.and_hms_milli_opt(h, m, s, milli).unwrap();
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_opt(3, 6, 0, 300).unwrap());
Source§

type Output = NaiveDateTime

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Duration) -> NaiveDateTime

Performs the - operation. Read more
Source§

impl Sub<Duration> for NaiveTime

Subtract chrono::Duration from NaiveTime.

This wraps around and never overflows or underflows. In particular the subtraction ignores integral number of days. This is the same as addition with a negated Duration.

As a part of Chrono’s leap second handling, the subtraction 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 = |h, m, s, milli| { NaiveTime::from_hms_milli_opt(h, m, s, milli).unwrap() };

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));
Source§

type Output = NaiveTime

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Duration) -> NaiveTime

Performs the - operation. Read more
Source§

impl Sub for Duration

Source§

type Output = Duration

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Duration) -> Duration

Performs the - operation. Read more
Source§

impl<Tz> SubAssign<Duration> for Date<Tz>
where Tz: TimeZone,

Source§

fn sub_assign(&mut self, rhs: Duration)

Performs the -= operation. Read more
Source§

impl<Tz> SubAssign<Duration> for DateTime<Tz>
where Tz: TimeZone,

Subtract-assign chrono::Duration from DateTime.

This 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 DateTime itself represents a leap second in which case the assumption becomes that there is exactly a single leap second ever.

§Panics

Panics if the resulting date would be out of range. Consider using DateTime<Tz>::checked_sub_signed to get an Option instead.

Source§

fn sub_assign(&mut self, rhs: Duration)

Performs the -= operation. Read more
Source§

impl SubAssign<Duration> for NaiveDate

Subtract-assign chrono::Duration from NaiveDate.

This discards the fractional days in Duration, rounding to the closest integral number of days towards Duration::zero(). It is the same as the addition with a negated Duration.

§Panics

Panics if the resulting date would be out of range. Consider using NaiveDate::checked_sub_signed to get an Option instead.

Source§

fn sub_assign(&mut self, rhs: Duration)

Performs the -= operation. Read more
Source§

impl SubAssign<Duration> for NaiveDateTime

Subtract-assign chrono::Duration from NaiveDateTime.

This 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

Panics if the resulting date would be out of range. Consider using NaiveDateTime::checked_sub_signed to get an Option instead.

Source§

fn sub_assign(&mut self, rhs: Duration)

Performs the -= operation. Read more
Source§

impl SubAssign<Duration> for NaiveTime

Subtract-assign chrono::Duration from NaiveTime.

This wraps around and never overflows or underflows. In particular the subtraction ignores integral number of days.

Source§

fn sub_assign(&mut self, rhs: Duration)

Performs the -= operation. Read more
Source§

impl SubAssign for Duration

Source§

fn sub_assign(&mut self, rhs: Duration)

Performs the -= operation. Read more
Source§

impl<'a> Sum<&'a Duration> for Duration

Source§

fn sum<I>(iter: I) -> Duration
where I: Iterator<Item = &'a Duration>,

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl Sum for Duration

Source§

fn sum<I>(iter: I) -> Duration
where I: Iterator<Item = Duration>,

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl Copy for Duration

Source§

impl Eq for Duration

Source§

impl StructuralPartialEq for Duration

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.