pub struct InvariantDataProvider;
Expand description

A locale-invariant data provider. Sometimes useful for testing. Not intended to be used in production environments.

The objects returned by InvariantDataProvider are guaranteed to conform to the correct struct definition, so InvariantDataProvider can also be used to validate unknown data providers.

Examples

use icu_provider::prelude::*;
use icu_provider::inv::InvariantDataProvider;
use icu_provider::hello_world::HelloWorldV1Marker;
use std::borrow::Cow;

let provider = InvariantDataProvider;
let result: DataPayload<HelloWorldV1Marker> = provider
    .load_resource(&DataRequest::default())
    .unwrap()
    .take_payload()
    .unwrap();

assert_eq!("(und) Hello World", result.get().message);

Trait Implementations

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

Given a ResourceKey, returns a boxed iterator over ResourceOptions.

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

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.