Type Definition timespan::NaiveTimeSpan
source · Expand description
The NaiveTimeSpan
alias is a span consisting of chrono::NaiveTime
s.
It can be used to represent time spans that do not depend on a specific time zone.
The NaiveTimeSpan
can be formatted and parsed from a string. It has full
support for serde
serialization and deserialization.
Example
use timespan::NaiveTimeSpan;
let a: NaiveTimeSpan = "17:30:00 - 19:15:00".parse().unwrap();
let b = NaiveTimeSpan::parse_from_str(
"05.30 PM - 07.15 PM",
"{start} - {end}",
"%I.%M %P", "%I.%M %P"
).unwrap();
let f = a.format("from {start} to {end}", "%R", "%R");
assert!(format!("{}", f) == "from 17:30 to 19:15");
assert!(a == b);