[][src]Struct activitystreams::primitives::XsdDuration

pub struct XsdDuration(_);

The type xsd:duration represents a duration of time expressed as a number of years, months, days, hours, minutes, and seconds.

The format of xsd:duration is PnYnMnDTnHnMnS, where P is a literal value that starts the expression, nY is the number of years followed by a literal Y, nM is the number of months followed by a literal M, nD is the number of days followed by a literal D, T is a literal value that separates the date and time, nH is the number of hours followed by a literal H, nM is the number of minutes followed by a literal M, and nS is the number of seconds followed by a literal S. The following rules apply to xsd:duration values:

  • Any of these numbers and corresponding designators may be absent if they are equal to 0, but at least one number and designator must appear.
  • The numbers may be any unsigned integer, with the exception of the number of seconds, which may be an unsigned decimal number.
  • If a decimal point appears in the number of seconds, there must be at least one digit after the decimal point.
  • A minus sign may appear before the P to specify a negative duration.
  • If no time items (hour, minute, second) are present, the letter T must not appear.

Note

This implementation converts Months to Days by multiplying by 31, and converts Years to days by multiplying by 365. If this is an issue for your application, look into specifying days directly.

Implementations

impl XsdDuration[src]

pub fn as_duration(&self) -> &Duration[src]

Borrow the underlying chrono::Duration

pub fn as_duration_mut(&mut self) -> &mut Duration[src]

Mutably borrow the underlying chrono::Duration

Trait Implementations

impl AsMut<Duration> for XsdDuration[src]

impl AsRef<Duration> for XsdDuration[src]

impl Clone for XsdDuration[src]

impl Debug for XsdDuration[src]

impl<'de> Deserialize<'de> for XsdDuration[src]

impl Display for XsdDuration[src]

impl Eq for XsdDuration[src]

impl From<Duration> for XsdDuration[src]

impl From<XsdDuration> for Duration[src]

impl FromStr for XsdDuration[src]

type Err = XsdDurationError

The associated error which can be returned from parsing.

impl Hash for XsdDuration[src]

impl Ord for XsdDuration[src]

impl PartialEq<XsdDuration> for XsdDuration[src]

impl PartialOrd<XsdDuration> for XsdDuration[src]

impl Serialize for XsdDuration[src]

impl StructuralEq for XsdDuration[src]

impl StructuralPartialEq for XsdDuration[src]

impl<'_> TryFrom<&'_ mut str> for XsdDuration[src]

type Error = XsdDurationError

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ str> for XsdDuration[src]

type Error = XsdDurationError

The type returned in the event of a conversion error.

impl TryFrom<String> for XsdDuration[src]

type Error = XsdDurationError

The type returned in the event of a conversion error.

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> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[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.