pub struct HelloWorldJsonProvider(_);
Expand description

A data provider returning Hello World strings in different languages as JSON blobs.

Mostly useful for testing.

Examples

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

let german_hello_world = HelloWorldProvider
    .into_json_provider()
    .load_buffer(HelloWorldV1Marker::KEY, DataRequest {
        locale: &locale!("de").into(),
        metadata: Default::default(),
    })
    .expect("Loading should succeed")
    .take_payload()
    .expect("Data should be present");

assert_eq!(b"{\"message\":\"Hallo Welt\"}", german_hello_world.get());

Trait Implementations

Loads a DataPayload<BufferMarker> according to the key and request.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

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.