Skip to main content

Module serde_time

Module serde_time 

Source
Expand description

Serde support for time fields in fact structs. Annotate DateTime fields with #[serde(with = "rust_runes::serde_time")] (or serde_time::option for Option<DateTime<_>>) and Fact::from_serialize turns them into time values that rules can compare and pass to the time functions. Without it, chrono serializes times as strings, and they reach rules as strings.

Outside fact conversion the fields serialize as ordinary RFC 3339 strings, so the annotation doesn’t change your other serialization.

Modules§

option
For Option<DateTime<_>> fields: #[serde(with = "rust_runes::serde_time::option")].

Functions§

deserialize
Deserializes a time field from an RFC 3339 string.
serialize
Serializes a time field (see the module docs).