Struct icu_provider::inv::InvariantDataProvider[][src]

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::{key, HelloWorldV1Marker};
use std::borrow::Cow;

let provider = InvariantDataProvider;
let result: DataPayload<HelloWorldV1Marker> = provider
    .load_payload(&DataRequest::from(key::HELLO_WORLD_V1))
    .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.

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

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.