Open ghost opened 3 years ago
Thanks you for reporting this!
Duration formats were supported in Hocon formats, but not all the way through deserialization... They now are (in 0.5.1), with an api inspired by humantime-serde
Either with an attribute: https://github.com/mockersf/hocon.rs/blob/0433e51e17f831aaa4ec7b39dadb5bc9c2b06f07/tests/deserialize.rs#L129-L133
Or with a wrapper type: https://github.com/mockersf/hocon.rs/blob/0433e51e17f831aaa4ec7b39dadb5bc9c2b06f07/tests/deserialize.rs#L113-L116
See the doc here: https://docs.rs/hocon/0.5.1/hocon/de/wrappers/struct.Serde.html
Hi, I'm using hocon 0.4.0 and serde 1.0.124. The config file says
blah = 1 second
, the config struct saysblah: std::time::Duration
, and hocon saysWhen I change the struct's field type from
std::time::Duration
toString
, then the struct field successfully gets the textual value1 second
.Am I doing something wrong please? I looked into Hocon's source code and it looks like
std::time::Duration
is supported.PS. Hocon is the best config format ever, loved it since Scala times, thanks for your work.