Struct icu_provider_adapters::empty::EmptyDataProvider
source · pub struct EmptyDataProvider {
error_kind: DataErrorKind,
}
Expand description
A data provider that always returns an error.
The returned error kind is configurable.
§Examples
use icu_provider::hello_world::HelloWorldV1Marker;
use icu_provider::prelude::*;
use icu_provider_adapters::empty::EmptyDataProvider;
let provider = EmptyDataProvider::new();
assert!(matches!(
provider.load_any(HelloWorldV1Marker::KEY, Default::default()),
Err(DataError {
kind: DataErrorKind::MissingDataKey,
..
})
));
Fields§
§error_kind: DataErrorKind
Implementations§
source§impl EmptyDataProvider
impl EmptyDataProvider
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a data provider that always returns DataErrorKind::MissingDataKey
.
sourcepub fn new_with_error_kind(error_kind: DataErrorKind) -> Self
pub fn new_with_error_kind(error_kind: DataErrorKind) -> Self
Creates a data provider that always returns the specified error kind.
Trait Implementations§
source§impl AnyProvider for EmptyDataProvider
impl AnyProvider for EmptyDataProvider
source§fn load_any(
&self,
key: DataKey,
base_req: DataRequest<'_>,
) -> Result<AnyResponse, DataError>
fn load_any( &self, key: DataKey, base_req: DataRequest<'_>, ) -> Result<AnyResponse, DataError>
Loads an
AnyPayload
according to the key and request.source§impl BufferProvider for EmptyDataProvider
impl BufferProvider for EmptyDataProvider
source§fn load_buffer(
&self,
key: DataKey,
base_req: DataRequest<'_>,
) -> Result<DataResponse<BufferMarker>, DataError>
fn load_buffer( &self, key: DataKey, base_req: DataRequest<'_>, ) -> Result<DataResponse<BufferMarker>, DataError>
source§impl<M> DataProvider<M> for EmptyDataProviderwhere
M: KeyedDataMarker,
impl<M> DataProvider<M> for EmptyDataProviderwhere
M: KeyedDataMarker,
source§fn load(&self, base_req: DataRequest<'_>) -> Result<DataResponse<M>, DataError>
fn load(&self, base_req: DataRequest<'_>) -> Result<DataResponse<M>, DataError>
Query the provider for data, returning the result. Read more
source§impl Debug for EmptyDataProvider
impl Debug for EmptyDataProvider
source§impl Default for EmptyDataProvider
impl Default for EmptyDataProvider
source§impl<M> DynamicDataProvider<M> for EmptyDataProviderwhere
M: DataMarker,
impl<M> DynamicDataProvider<M> for EmptyDataProviderwhere
M: DataMarker,
source§fn load_data(
&self,
key: DataKey,
base_req: DataRequest<'_>,
) -> Result<DataResponse<M>, DataError>
fn load_data( &self, key: DataKey, base_req: DataRequest<'_>, ) -> Result<DataResponse<M>, DataError>
Query the provider for data, returning the result. Read more
Auto Trait Implementations§
impl Freeze for EmptyDataProvider
impl RefUnwindSafe for EmptyDataProvider
impl Send for EmptyDataProvider
impl Sync for EmptyDataProvider
impl Unpin for EmptyDataProvider
impl UnwindSafe for EmptyDataProvider
Blanket Implementations§
source§impl<P> AsDowncastingAnyProvider for Pwhere
P: AnyProvider + ?Sized,
impl<P> AsDowncastingAnyProvider for Pwhere
P: AnyProvider + ?Sized,
source§fn as_downcasting(&self) -> DowncastingAnyProvider<'_, P>
fn as_downcasting(&self) -> DowncastingAnyProvider<'_, P>
Returns an object implementing
DynamicDataProvider<M>
when called on AnyProvider
source§impl<P> AsDynamicDataProviderAnyMarkerWrap for P
impl<P> AsDynamicDataProviderAnyMarkerWrap for P
source§fn as_any_provider(&self) -> DynamicDataProviderAnyMarkerWrap<'_, P>
fn as_any_provider(&self) -> DynamicDataProviderAnyMarkerWrap<'_, P>
Returns an object implementing
AnyProvider
when called on DynamicDataProvider<AnyMarker>
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
Creates a filterable data provider with the given name for debugging. Read more