Trait TimeRepresentation

Source
pub trait TimeRepresentation:
    TimeMode
    + Clone
    + Send
    + Default
    + CondSerialize
    + CondDeserialize
    + 'static {
    type InnerTime: Debug + Clone + Send + CondSerialize + CondDeserialize;

    // Required methods
    fn convert_from(&mut self, inner: Self::InnerTime) -> Time;
    fn convert_into(&self, ts: Time) -> Self::InnerTime;
    fn to_string(&self, ts: Self::InnerTime) -> String;
    fn parse(s: &str) -> Result<Self::InnerTime, String>;

    // Provided methods
    fn default_start_time() -> Option<SystemTime> { ... }
    fn init_start_time(
        &mut self,
        start: Option<SystemTime>,
    ) -> Arc<RwLock<Option<SystemTime>>> { ... }
    fn set_start_time(&mut self, _start_time: Arc<RwLock<Option<SystemTime>>>) { ... }
}
Expand description

The functionality a time format has to provide.

Required Associated Types§

Source

type InnerTime: Debug + Clone + Send + CondSerialize + CondDeserialize

The internal representation of the time format.

Required Methods§

Source

fn convert_from(&mut self, inner: Self::InnerTime) -> Time

Convert from the internal time representation to the monitor time.

Source

fn convert_into(&self, ts: Time) -> Self::InnerTime

Convert from monitor time to the internal representation.

Source

fn to_string(&self, ts: Self::InnerTime) -> String

Convert the internal representation into a string.

Source

fn parse(s: &str) -> Result<Self::InnerTime, String>

Parse the internal representation from a string and convert it into monitor time.

Provided Methods§

Source

fn default_start_time() -> Option<SystemTime>

Returns a default start time if applicable for the time representation.

Source

fn init_start_time( &mut self, start: Option<SystemTime>, ) -> Arc<RwLock<Option<SystemTime>>>

Initializes the start time of the time representation.

Source

fn set_start_time(&mut self, _start_time: Arc<RwLock<Option<SystemTime>>>)

Set an already initialized start time.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§