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§
Sourcefn load_bound(&self, req: DataRequest<'_>) -> Result<DataResponse<M>, DataError>
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.