Struct icu_provider::hello_world::HelloWorldProvider[][src]

pub struct HelloWorldProvider<'data> { /* fields omitted */ }
Expand description

A data provider returning Hello World strings in different languages.

Mostly useful for testing.

Examples

use icu_provider::hello_world::{key, HelloWorldProvider, HelloWorldV1Marker};
use icu_provider::prelude::*;
use icu_locid_macros::langid;

let provider = HelloWorldProvider::new_with_placeholder_data();

let german_hello_world: DataPayload<HelloWorldV1Marker> = provider
    .load_payload(&DataRequest {
        resource_path: ResourcePath {
            key: key::HELLO_WORLD_V1,
            options: ResourceOptions {
                variant: None,
                langid: Some(langid!("de")),
            }
        }
    })
    .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.

Trait Implementations

Adds entries to a HelloWorldProvider from ErasedDataStruct

Save a payload corresponding to the given data request (resource path).

Function called after a key has been fully dumped into the exporter.

Function called after all keys have been fully dumped.

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

Formats the value using the given formatter. Read more

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

Given a ResourceKey, 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 !=.

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

Query the provider for data, returning the result as an ErasedDataStruct trait object. Read more

Clone this trait object reference, returning a boxed trait object.

Return this boxed trait object as Box<dyn Any>. Read more

Return this trait object reference as &dyn Any. Read more

Performs the conversion.

Performs the conversion.

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.