Struct veeks_millis::MilliTime[][src]

pub struct MilliTime { /* fields omitted */ }

milli_time format is fixed and global: from 000md to 999md, always 3 digits, no space, suffix md

Implementations

impl MilliTime[src]

pub fn from_hms(hour: u32, minute: u32, second: u32) -> Option<Self>[src]

constructor from hour, minute, second, rounded to 1md returns None on error

Example

let millis = veeks_millis::MilliTime::from_hms(13,53,58).unwrap();
assert_eq!(millis.to_string(),"579md");

pub fn from_naive_time(nt: NaiveTime) -> Self[src]

constructor from chrono NaiveTime, rounded to 1md

Example

let nt = chrono::NaiveTime::from_hms(13,30,00);
let millis = veeks_millis::MilliTime::from_naive_time(nt);
assert_eq!(millis.milliday(),563);

pub fn from_str(s: &str) -> Option<Self>[src]

constructor from string millis 000md to 999md returns None if unrecognized format

Example

let millis = veeks_millis::MilliTime::from_str("560md").unwrap();
assert_eq!(millis.milliday(),560);

pub fn milliday(&self) -> u32[src]

getter milliday f64

Example

let veeks = veeks_millis::MilliTime::from_hms(13,53,58).unwrap();
assert_eq!(veeks.milliday(),579);

pub fn to_naive_time(&self) -> Option<NaiveTime>[src]

convert millis to chrono NaiveTime rounded to 1 second returns None if error

Example

let millis = veeks_millis::MilliTime::from_str("560md").unwrap();
let nt = millis.to_naive_time().unwrap();
assert_eq!(nt,chrono::NaiveTime::from_hms(13,26,24));

Trait Implementations

impl Display for MilliTime[src]

the Trait Display implements fn to_string() implicitly

Auto Trait Implementations

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> From<T> for T[src]

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

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.