Trait bonsaidb_core::key::time::limited::TimeResolution
source · pub trait TimeResolution: Debug + Send + Sync {
type Representation: Variable + Serialize + for<'de> Deserialize<'de> + for<'k> Key<'k> + Display + Hash + Eq + PartialEq + Ord + PartialOrd + 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§
Required Associated Constants§
sourceconst FORMAT_SUFFIX: &'static str
const FORMAT_SUFFIX: &'static str
The label used when formatting times with this resolution.
Required Methods§
sourcefn 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
.
sourcefn 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
.