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::HelloWorldV1;
use icu_provider::prelude::*;
use icu_provider_adapters::empty::EmptyDataProvider;
let provider = EmptyDataProvider::new();
assert!(matches!(
DataProvider::<HelloWorldV1>::load(&provider, Default::default()),
Err(DataError {
kind: DataErrorKind::MarkerNotFound,
..
})
));Fields§
§error_kind: DataErrorKindImplementations§
Source§impl EmptyDataProvider
impl EmptyDataProvider
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a data provider that always returns DataErrorKind::MarkerNotFound.
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<M> DataProvider<M> for EmptyDataProviderwhere
M: DataMarker,
impl<M> DataProvider<M> for EmptyDataProviderwhere
M: DataMarker,
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: DynamicDataMarker,
impl<M> DynamicDataProvider<M> for EmptyDataProviderwhere
M: DynamicDataMarker,
Source§fn load_data(
&self,
marker: DataMarkerInfo,
base_req: DataRequest<'_>,
) -> Result<DataResponse<M>, DataError>
fn load_data( &self, marker: DataMarkerInfo, base_req: DataRequest<'_>, ) -> Result<DataResponse<M>, DataError>
Query the provider for data, returning the result. Read more
Source§impl<M> IterableDataProvider<M> for EmptyDataProviderwhere
M: DataMarker,
impl<M> IterableDataProvider<M> for EmptyDataProviderwhere
M: DataMarker,
Source§fn iter_ids(&self) -> Result<BTreeSet<DataIdentifierCow<'_>>, DataError>
fn iter_ids(&self) -> Result<BTreeSet<DataIdentifierCow<'_>>, DataError>
Returns a set of
DataIdentifierCow.Source§impl<M> IterableDynamicDataProvider<M> for EmptyDataProviderwhere
M: DynamicDataMarker,
impl<M> IterableDynamicDataProvider<M> for EmptyDataProviderwhere
M: DynamicDataMarker,
Source§fn iter_ids_for_marker(
&self,
_: DataMarkerInfo,
) -> Result<BTreeSet<DataIdentifierCow<'_>>, DataError>
fn iter_ids_for_marker( &self, _: DataMarkerInfo, ) -> Result<BTreeSet<DataIdentifierCow<'_>>, DataError>
Given a
DataMarkerInfo, returns a set of DataIdentifierCow.Auto Trait Implementations§
impl Freeze for EmptyDataProvider
impl RefUnwindSafe for EmptyDataProvider
impl Send for EmptyDataProvider
impl Sync for EmptyDataProvider
impl Unpin for EmptyDataProvider
impl UnsafeUnpin for EmptyDataProvider
impl UnwindSafe for EmptyDataProvider
Blanket Implementations§
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