pub struct HelloWorldProvider;
Expand description

A data provider returning Hello World strings in different languages.

Mostly useful for testing.

Examples

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

let german_hello_world: DataPayload<HelloWorldV1Marker> =
    HelloWorldProvider
        .load(DataRequest {
            locale: &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

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

Trait Implementations

Attempt to convert a payload corresponding to the given data key from one marker type to another marker type. Read more

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

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

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

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Returns an object implementing AnyProvider when called on DynamicDataProvider<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.