| 1 |
// This file is part of ICU4X. For terms of use, please see the file |
| 2 |
// called LICENSE at the top level of the ICU4X source tree |
| 3 |
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). |
| 4 |
|
| 5 |
//! This module contains scaffolding for baked providers, typically generated using |
| 6 |
//! databake. |
| 7 |
//! |
| 8 |
//! It can be glob-imported, and includes the [`icu_provider`](crate) prelude. |
| 9 |
//! |
| 10 |
//! This needs the `"baked"` feature to be enabled. |
| 11 |
|
| 12 |
pub mod zerotrie; |
| 13 |
use crate::prelude::{DataIdentifierBorrowed, DataMarker, DataPayload}; |
| 14 |
|
| 15 |
/// A backing store for baked data |
| 16 |
pub trait DataStore<M: DataMarker>: private::Sealed { |
| 17 |
/// Get the value for a key |
| 18 |
fn get( |
| 19 |
&self, |
| 20 |
req: DataIdentifierBorrowed, |
| 21 |
attributes_prefix_match: bool, |
| 22 |
) -> Option<DataPayload<M>>; |
| 23 |
|
| 24 |
/// The type returned by the iterator |
| 25 |
/// |
| 26 |
/// ✨ *Enabled with the `alloc` Cargo feature.* |
| 27 |
#[cfg(feature = "alloc")] |
| 28 |
type IterReturn: Iterator<Item = crate::prelude::DataIdentifierCow<'static>>; |
| 29 |
/// Iterate over all data |
| 30 |
/// |
| 31 |
/// ✨ *Enabled with the `alloc` Cargo feature.* |
| 32 |
#[cfg(feature = "alloc")] |
| 33 |
fn iter(&'static self) -> Self::IterReturn; |
| 34 |
} |
| 35 |
|
| 36 |
pub(crate) mod private { |
| 37 |
pub trait Sealed {} |
| 38 |
} |