icu_provider

Trait BoundDataProvider

Source
pub trait BoundDataProvider<M>
where M: DataMarker,
{ // Required methods fn load_bound( &self, req: DataRequest<'_>, ) -> Result<DataResponse<M>, DataError>; fn bound_key(&self) -> DataKey; }
Expand description

A data provider that loads data for a specific data type.

Unlike DataProvider, the provider is bound to a specific key ahead of time.

This crate provides DataProviderWithKey which implements this trait on a single provider with a single key. However, this trait can also be implemented on providers that fork between multiple keys that all return the same data type. For example, it can abstract over many calendar systems in the datetime formatter.

Required Methods§

Source

fn load_bound(&self, req: DataRequest<'_>) -> Result<DataResponse<M>, DataError>

Query the provider for data, returning the result.

Returns Ok if the request successfully loaded data. If data failed to load, returns an Error with more information.

Source

fn bound_key(&self) -> DataKey

Returns the DataKey that this provider uses for loading data.

Implementations on Foreign Types§

Source§

impl<'a, M, P> BoundDataProvider<M> for &'a P
where M: DataMarker, P: BoundDataProvider<M> + ?Sized,

Source§

impl<M, P> BoundDataProvider<M> for Box<P>
where M: DataMarker, P: BoundDataProvider<M> + ?Sized,

Source§

impl<M, P> BoundDataProvider<M> for Rc<P>
where M: DataMarker, P: BoundDataProvider<M> + ?Sized,

Source§

impl<M, P> BoundDataProvider<M> for Arc<P>
where M: DataMarker, P: BoundDataProvider<M> + ?Sized,

Implementors§

Source§

impl<M, M0, Y, P> BoundDataProvider<M0> for DataProviderWithKey<M, P>
where M: KeyedDataMarker<Yokeable = Y>, M0: DataMarker<Yokeable = Y>, Y: for<'a> Yokeable<'a>, P: DataProvider<M>,