Macro elastic_types::date_fmt
[−]
[src]
macro_rules! date_fmt { ($format_ty:ty, $format_pat:tt, $es_format:expr) => { ... }; }
Implement DateFormat
for the given type.
Examples
The macro takes 2 string literals; the format to parse and the name to use in Elasticsearch:
#[macro_use] extern crate elastic_date_macros; #[derive(Default, Clone)] struct MyFormat; date_fmt!(MyFormat, "yyyy-MM-ddTHH:mm:ssZ", "yyyy-MM-dd'T'HH:mm:ssZ");
You can then use MyFormat
as the generic parameter in Date
.
NOTE: The
date_fmt
macro expects you to have theelastic_date_macros
crate imported.