[−][src]Function ms_converter::ms_into_time
pub fn ms_into_time<'a, T>(s: T) -> Result<Duration, Error> where
T: Into<Cow<'a, str>>,
Ms into time is the abstraction on ms
function, which converts result into time.Duration
type.
ms_into_time
function gets an str slice or String and returns time.Duration
.
ms_into_time
has some limitations, it's not working with negative values:
use crate::ms_converter::ms_into_time; let value = ms_into_time("-1d").is_err(); assert_eq!(value, true)
Usage
use crate::ms_converter::ms_into_time; let value = ms_into_time("1d").unwrap(); assert_eq!(value.as_millis(), 86400000)