Struct icu_datagen::DatagenDriver
source · pub struct DatagenDriver { /* private fields */ }
Expand description
Configuration for a data export operation.
Note that this only configures which data is exported. The input provider, usually
DatagenProvider
, might expose more options about the data itself.
Examples
use icu_datagen::blob_exporter::*;
use icu_datagen::prelude::*;
DatagenDriver::new()
.with_keys([icu::list::provider::AndListV1Marker::KEY])
.with_all_locales()
.export(
&DatagenProvider::new_latest_tested(),
BlobExporter::new_with_sink(Box::new(&mut Vec::new())),
)
.unwrap();
Implementations§
source§impl DatagenDriver
impl DatagenDriver
sourcepub fn new() -> Self
pub fn new() -> Self
Creates an empty DatagenDriver
.
Note that keys and locales need to be set before calling export
.
sourcepub fn with_keys(self, keys: impl IntoIterator<Item = DataKey>) -> Self
pub fn with_keys(self, keys: impl IntoIterator<Item = DataKey>) -> Self
Sets this driver to generate the given keys.
See icu_datagen::keys
, icu_datagen::all_keys
, icu_datagen::key
and icu_datagen::keys_from_bin
.
sourcepub fn with_locales(
self,
locales: impl IntoIterator<Item = LanguageIdentifier>
) -> Self
pub fn with_locales( self, locales: impl IntoIterator<Item = LanguageIdentifier> ) -> Self
Sets this driver to generate the given locales.
Use the langid!
macro from the prelude to create an
explicit list, or DatagenProvider::locales_for_coverage_levels
for CLDR coverage levels.
sourcepub fn with_all_locales(self) -> Self
pub fn with_all_locales(self) -> Self
Sets this driver to generate all available locales.
sourcepub fn with_fallback_mode(self, fallback: FallbackMode) -> Self
pub fn with_fallback_mode(self, fallback: FallbackMode) -> Self
Sets the fallback type that the data should be generated for.
If locale fallback is used at runtime, smaller data can be generated.
sourcepub fn with_additional_collations(
self,
additional_collations: impl IntoIterator<Item = String>
) -> Self
pub fn with_additional_collations( self, additional_collations: impl IntoIterator<Item = String> ) -> Self
This option is only relevant if using icu::collator
.
By default, the collations big5han
, gb2312
, and those starting with search
are excluded. This method can be used to reennable them.
The special string "search*"
causes all search collation tables to be included.
sourcepub fn with_recommended_segmenter_models(self) -> Self
pub fn with_recommended_segmenter_models(self) -> Self
This option is only relevant if using icu::segmenter
.
Sets this driver to generate the recommended segmentation models, to the extent required by the chosen data keys.
sourcepub fn with_segmenter_models(
self,
models: impl IntoIterator<Item = String>
) -> Self
pub fn with_segmenter_models( self, models: impl IntoIterator<Item = String> ) -> Self
This option is only relevant if using icu::segmenter
.
Sets this driver to generate the given segmentation models, to the extent required by the chosen data keys.
The currently supported dictionary models are
cjdict
burmesedict
khmerdict
laodict
thaidict
The currently supported LSTM models are
Burmese_codepoints_exclusive_model4_heavy
Khmer_codepoints_exclusive_model4_heavy
Lao_codepoints_exclusive_model4_heavy
Thai_codepoints_exclusive_model4_heavy
If a model is not included, the resulting line or word segmenter will apply rule-based segmentation when encountering text in a script that requires the model, which will be incorrect.
If multiple models for the same language and segmentation type (dictionary/LSTM) are listed, the first one will be used.
sourcepub fn export(
self,
provider: &impl ExportableProvider,
sink: impl DataExporter
) -> Result<(), DataError>
pub fn export( self, provider: &impl ExportableProvider, sink: impl DataExporter ) -> Result<(), DataError>
Exports data from the given provider to the given exporter.
See
DatagenProvider
,
make_exportable_provider!
,
BlobExporter
,
FileSystemExporter
,
and BakedExporter
.
Trait Implementations§
source§impl Clone for DatagenDriver
impl Clone for DatagenDriver
source§fn clone(&self) -> DatagenDriver
fn clone(&self) -> DatagenDriver
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more