Date-time formatter using lazy_static-initialized data provider

Hello again. I'm having trouble integrating date-time formatting with my localization crate. I've integrated relative-time formatting successfully though. I'm using the high-level icu_datetime crate. I've this data provider (

lazy_static! {
    static ref ICU_PROVIDER: icu_provider_fs::FsDataProvider = icu_testdata::get_provider();

I'm using it here (blob):

impl LocaleMap {
    pub fn create_date_time_formatter(&self, options: &super::date_time_format::DateTimeFormatOptions) -> super::DateTimeFormatter {
        // ...
        let mut r = super::date_time_format::DateTimeFormatter::try_new(lid, &ICU_PROVIDER, options);
        // ...

The compiler is generating:

the trait bound ICU_PROVIDER: icu_provider::data_provider::DataProvider<'_> is not satisfied
the trait icu_provider::data_provider::DataProvider<'_> is not implemented for ICU_PROVIDER

Consulting the documentation (, I don't see what is missing. Am I accessing my static variable in the wrong way?

Try using &*ICU_PROVIDER instead of &ICU_PROVIDER.

The lazy_static macro creates a wrapper that implements the Deref trait. You can use the * operator to dereference it and access the underlying FsDataProvider value.

In many cases, the compiler will do this dereferencing automatically, but in some cases (in particular, when calling a generic function), it does not happen automatically.

Thanks, so it was really a lazy_static issue.