[][src]Struct holochain_core_types::time::Iso8601

pub struct Iso8601(_);

This struct represents datetime data recovered from a string in the ISO 8601 and RFC 3339 (more restrictive) format. Invalid try_from conversions fails w/ Result<DateTime, HolochainError>.

Iso8601 wraps a DateTime, and its Display/Debug formats default to the ISO 8601 / RFC 3339 format, respectively:

Display: 2018-10-11T03:23:38+00:00 Debug: Iso8601(2018-10-11T03:23:38+00:00)

More info on the relevant wikipedia article.

Methods

impl Iso8601[src]

Infallible conversions into and from an Iso8601. The only infallible ways to create an Iso8601 is from a Unix timestamp, or new with a timestamp and nanoseconds, or by converting to/from its underlying DateTime.

pub fn new(secs: i64, nsecs: u32) -> Self[src]

Trait Implementations

impl<'a> From<&'a Iso8601> for JsonString[src]

impl From<Iso8601> for JsonString[src]

impl From<i64> for Iso8601[src]

impl From<u64> for Iso8601[src]

impl From<i32> for Iso8601[src]

impl From<u32> for Iso8601[src]

impl From<Iso8601> for DateTime<FixedOffset>[src]

impl<'_> From<&'_ Iso8601> for DateTime<FixedOffset>[src]

impl From<DateTime<FixedOffset>> for Iso8601[src]

impl<'_> From<&'_ DateTime<FixedOffset>> for Iso8601[src]

impl Clone for Iso8601[src]

impl Eq for Iso8601[src]

impl Ord for Iso8601[src]

impl PartialEq<Iso8601> for Iso8601[src]

impl PartialOrd<Iso8601> for Iso8601[src]

impl Display for Iso8601[src]

Outputs the canonicalized ISO 8601 / RFC 3339 form for a valid timestamp.

impl Debug for Iso8601[src]

impl<D: Into<Duration>> Sub<D> for Iso8601[src]

type Output = Result<Iso8601, HolochainError>

The resulting type after applying the - operator.

impl<'_, D: Into<Duration>> Sub<D> for &'_ Iso8601[src]

type Output = Result<Iso8601, HolochainError>

The resulting type after applying the - operator.

impl<'a> TryFrom<&'a JsonString> for Iso8601[src]

type Error = JsonError

The type returned in the event of a conversion error.

impl TryFrom<JsonString> for Iso8601[src]

type Error = JsonError

The type returned in the event of a conversion error.

impl TryFrom<String> for Iso8601[src]

Conversions try_from on String/&str on an Iso8601 are fallible conversions, which may produce a HolochainError if the timestamp is not valid ISO 8601 / RFC 3339. We will allow some flexibilty; strip surrounding whitespace, a bare timestamp missing any timezone specifier will be assumed to be UTC "Zulu", make internal separators optional if unambiguous. If you keep to straight RFC 3339 timestamps, then parsing will be quick, otherwise we'll employ a regular expression to parse a more flexible subset of the ISO 8601 standard from your supplied timestamp, and then use the RFC 3339 parser again. We only do this validation once; at the creation of an Iso8601 from a String/&str. There are some years that can be encoded as a DateTime but not parsed, such as negative (BC/BCE) years.

type Error = HolochainError

The type returned in the event of a conversion error.

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

type Error = HolochainError

The type returned in the event of a conversion error.

impl FromStr for Iso8601[src]

type Err = HolochainError

The associated error which can be returned from parsing.

impl<D: Into<Duration>> Add<D> for Iso8601[src]

Iso8601 +- Into: Add anything that can be converted into a std::time::Duration; for example, a Timeout or a Period. On Err, always represents the std::time::Duration as a Period for ease of interpretation.

type Output = Result<Iso8601, HolochainError>

The resulting type after applying the + operator.

impl<'_, D: Into<Duration>> Add<D> for &'_ Iso8601[src]

type Output = Result<Iso8601, HolochainError>

The resulting type after applying the + operator.

impl StructuralPartialEq for Iso8601[src]

impl StructuralEq for Iso8601[src]

impl Serialize for Iso8601[src]

Serialization w/ serde_json to/from String. This means that a timestamp will be deserialized to an Iso8601 and validated, which may fail, returning a serde::de::Error. Upon serialization, the canonicalized ISO 8601 / RFC 3339 version of the timestamp will be used.

impl<'d> Deserialize<'d> for Iso8601[src]

Auto Trait Implementations

impl Send for Iso8601

impl Sync for Iso8601

impl Unpin for Iso8601

impl UnwindSafe for Iso8601

impl RefUnwindSafe for Iso8601

Blanket Implementations

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

impl<T> From<T> for 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.

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

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

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

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

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,