[][src]Struct hdk::prelude::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.

Implementations

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) -> Iso8601[src]

Trait Implementations

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

type Output = Result<Iso8601, HolochainError>

The resulting type after applying the + operator.

impl<D> Add<D> for Iso8601 where
    D: Into<Duration>, 
[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 Clone for Iso8601[src]

impl Copy for Iso8601[src]

impl Debug for Iso8601[src]

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

impl Display for Iso8601[src]

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

impl Eq for Iso8601[src]

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

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

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

impl From<Iso8601> for JsonString[src]

impl From<i32> for Iso8601[src]

impl From<i64> for Iso8601[src]

impl From<u32> for Iso8601[src]

impl From<u64> for Iso8601[src]

impl FromStr for Iso8601[src]

type Err = HolochainError

The associated error which can be returned from parsing.

impl Hash for Iso8601[src]

impl Ord for Iso8601[src]

impl PartialEq<Iso8601> for Iso8601[src]

impl PartialOrd<Iso8601> 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> Sub<D> for &'_ Iso8601 where
    D: Into<Duration>, 
[src]

type Output = Result<Iso8601, HolochainError>

The resulting type after applying the - operator.

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

type Output = Result<Iso8601, HolochainError>

The resulting type after applying the - operator.

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

type Error = HolochainError

The type returned in the event of a conversion error.

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.

Auto Trait Implementations

impl RefUnwindSafe for Iso8601

impl Send for Iso8601

impl Sync for Iso8601

impl Unpin for Iso8601

impl UnwindSafe for Iso8601

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> Clone for T where
    T: Clone
[src]

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

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

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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<V, T> VZip<V> for T where
    V: MultiLane<T>,