[−][src]Struct activitystreams::primitives::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]
fn clone(&self) -> XsdDuration
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for XsdDuration
[src]
impl<'de> Deserialize<'de> for XsdDuration
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
impl Display for XsdDuration
[src]
impl Eq for XsdDuration
[src]
impl From<Duration> for XsdDuration
[src]
impl From<XsdDuration> for Duration
[src]
fn from(d: XsdDuration) -> Self
[src]
impl FromStr for XsdDuration
[src]
type Err = XsdDurationError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl Hash for XsdDuration
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for XsdDuration
[src]
fn cmp(&self, other: &XsdDuration) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<XsdDuration> for XsdDuration
[src]
fn eq(&self, other: &XsdDuration) -> bool
[src]
fn ne(&self, other: &XsdDuration) -> bool
[src]
impl PartialOrd<XsdDuration> for XsdDuration
[src]
fn partial_cmp(&self, other: &XsdDuration) -> Option<Ordering>
[src]
fn lt(&self, other: &XsdDuration) -> bool
[src]
fn le(&self, other: &XsdDuration) -> bool
[src]
fn gt(&self, other: &XsdDuration) -> bool
[src]
fn ge(&self, other: &XsdDuration) -> bool
[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.
fn try_from(s: &mut str) -> Result<Self, Self::Error>
[src]
impl<'_> TryFrom<&'_ str> for XsdDuration
[src]
type Error = XsdDurationError
The type returned in the event of a conversion error.
fn try_from(s: &str) -> Result<Self, Self::Error>
[src]
impl TryFrom<String> for XsdDuration
[src]
Auto Trait Implementations
impl RefUnwindSafe for XsdDuration
impl Send for XsdDuration
impl Sync for XsdDuration
impl Unpin for XsdDuration
impl UnwindSafe for XsdDuration
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,