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:

use std::marker::PhantomData;

#[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.