pub trait TimeResolution: Debug + Send + Sync {
    type Representation: Variable + Serialize + for<'de> Deserialize<'de> + for<'k> Key<'k> + Display + Hash + Eq + PartialEq<Self::Representation> + Ord + PartialOrd<Self::Representation> + Clone + Copy + Send + Sync + Debug + Default;

    const FORMAT_SUFFIX: &'static str;

    // Required methods
    fn repr_to_duration(
        value: Self::Representation
    ) -> Result<SignedDuration, TimeError>;
    fn duration_to_repr(
        duration: SignedDuration
    ) -> Result<Self::Representation, TimeError>;
}
Expand description

A resolution of a time measurement.

Required Associated Types§

type Representation: Variable + Serialize + for<'de> Deserialize<'de> + for<'k> Key<'k> + Display + Hash + Eq + PartialEq<Self::Representation> + Ord + PartialOrd<Self::Representation> + Clone + Copy + Send + Sync + Debug + Default

The in-memory and serialized representation for this resolution.

Required Associated Constants§

const FORMAT_SUFFIX: &'static str

The label used when formatting times with this resolution.

Required Methods§

Implementors§

§

impl TimeResolution for Days

§

type Representation = i32

§

const FORMAT_SUFFIX: &'static str = "d"

§

impl TimeResolution for Hours

§

type Representation = i32

§

const FORMAT_SUFFIX: &'static str = "h"

§

impl TimeResolution for Microseconds

§

type Representation = i64

§

const FORMAT_SUFFIX: &'static str = "us"

§

impl TimeResolution for Milliseconds

§

type Representation = i64

§

const FORMAT_SUFFIX: &'static str = "ms"

§

impl TimeResolution for Minutes

§

type Representation = i32

§

const FORMAT_SUFFIX: &'static str = "m"

§

impl TimeResolution for Nanoseconds

§

type Representation = i64

§

const FORMAT_SUFFIX: &'static str = "ns"

§

impl TimeResolution for Seconds

§

type Representation = i64

§

const FORMAT_SUFFIX: &'static str = "s"

§

impl TimeResolution for Weeks

§

type Representation = i32

§

const FORMAT_SUFFIX: &'static str = "w"