pub struct HelloWorldProvider { /* private fields */ }
Expand description

A data provider returning Hello World strings in different languages.

Mostly useful for testing.

Examples

use icu_provider::hello_world::*;
use icu_provider::prelude::*;
use icu_locid::locale;

let provider = HelloWorldProvider::new_with_placeholder_data();

let german_hello_world: DataPayload<HelloWorldV1Marker> = provider
    .load_resource(&DataRequest {
        options: locale!("de").into(),
        metadata: Default::default(),
    })
    .expect("Loading should succeed")
    .take_payload()
    .expect("Data should be present");

assert_eq!("Hallo Welt", german_hello_world.get().message);

Implementations

Creates a HelloWorldProvider pre-populated with hardcoded data from Wiktionary.

Converts this provider into one that serves JSON blobs of the same data.

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Query the provider for data, returning the result. Read more

Query the provider for data, returning the result. Read more

Query the provider for data, returning the result. Read more

Given a ResourceKey, returns a boxed iterator over ResourceOptions.

Given a ResourceKey, returns a boxed iterator over ResourceOptions.

Returns a boxed iterator over ResourceOptions.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Query the provider for data, returning the result. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Returns an object implementing AnyProvider when called on DynProvider<AnyMarker>

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.