Module icu_provider_adapters::filter

source ·
Expand description

Providers that filter resource requests.

Requests that fail a filter test will return DataError of kind FilteredResource and will not appear in IterableDynamicDataProvider iterators.

The main struct is RequestFilterDataProvider. Although that struct can be created directly, the traits in this module provide helper functions for common filtering patterns.

To create a RequestFilterDataProvider, you can use the Filterable blanket function:

use icu_provider_adapters::filter::Filterable;

// now call .filterable() on any object to get a RequestFilterDataProvider

§Examples

use icu_locid::subtags::language;
use icu_provider::hello_world::*;
use icu_provider::prelude::*;
use icu_provider_adapters::filter::Filterable;

// Only return German data from a HelloWorldProvider:
HelloWorldProvider
    .filterable("Demo German-only filter")
    .filter_by_langid(|langid| langid.language == language!("de"));

Modules§

Structs§

Traits§