Struct icu_provider::inv::InvariantDataProvider
source · [−]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
sourceimpl<M> DynProvider<M> for InvariantDataProvider where
M: DataMarker,
M::Yokeable: Default,
impl<M> DynProvider<M> for InvariantDataProvider where
M: DataMarker,
M::Yokeable: Default,
sourcefn load_payload(
&self,
_: ResourceKey,
_: &DataRequest
) -> Result<DataResponse<M>, DataError>
fn load_payload(
&self,
_: ResourceKey,
_: &DataRequest
) -> Result<DataResponse<M>, DataError>
Query the provider for data, returning the result. Read more
sourceimpl<M> IterableDynProvider<M> for InvariantDataProvider where
M: DataMarker,
M::Yokeable: Default,
impl<M> IterableDynProvider<M> for InvariantDataProvider where
M: DataMarker,
M::Yokeable: Default,
sourcefn supported_options_for_key(
&self,
_: ResourceKey
) -> Result<Box<dyn Iterator<Item = ResourceOptions>>, DataError>
fn supported_options_for_key(
&self,
_: ResourceKey
) -> Result<Box<dyn Iterator<Item = ResourceOptions>>, DataError>
Given a ResourceKey
, returns a boxed iterator over ResourceOptions
.
sourceimpl<M> ResourceProvider<M> for InvariantDataProvider where
M: ResourceMarker,
M::Yokeable: Default,
impl<M> ResourceProvider<M> for InvariantDataProvider where
M: ResourceMarker,
M::Yokeable: Default,
sourcefn load_resource(&self, _: &DataRequest) -> Result<DataResponse<M>, DataError>
fn load_resource(&self, _: &DataRequest) -> Result<DataResponse<M>, DataError>
Query the provider for data, returning the result. Read more
Auto Trait Implementations
impl RefUnwindSafe for InvariantDataProvider
impl Send for InvariantDataProvider
impl Sync for InvariantDataProvider
impl Unpin for InvariantDataProvider
impl UnwindSafe for InvariantDataProvider
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more