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
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
const FORMAT_SUFFIX: &'static str
The label used when formatting times with this resolution.
Required Methods§
fn repr_to_duration(
value: Self::Representation
) -> Result<SignedDuration, TimeError>
fn repr_to_duration( value: Self::Representation ) -> Result<SignedDuration, TimeError>
Converts a Self::Representation
to Duration
.
fn duration_to_repr(
duration: SignedDuration
) -> Result<Self::Representation, TimeError>
fn duration_to_repr( duration: SignedDuration ) -> Result<Self::Representation, TimeError>
Converts a Duration
to Self::Representation
.