Expand description
icu_provider_export
is a library to generate data files that can be used in ICU4X data providers.
For command-line usage, see the icu4x-datagen
binary.
Also see our datagen tutorial.
§Examples
use icu_provider_export::blob_exporter::*;
use icu_provider_export::prelude::*;
use icu_provider_source::SourceDataProvider;
use std::fs::File;
let provider = SourceDataProvider::new();
ExportDriver::new(
[DataLocaleFamily::FULL],
DeduplicationStrategy::None.into(),
LocaleFallbacker::try_new_unstable(&provider).unwrap(),
)
.with_markers([icu::list::provider::ListAndV1::INFO])
.export(
&provider,
BlobExporter::new_with_sink(Box::new(
File::create("data.postcard").unwrap(),
)),
)
.unwrap();
§Cargo features
baked_exporter
- enables the
baked_exporter
module, a reexport oficu_provider_baked::export
- enables the
blob_exporter
- enables the
blob_exporter
module, a reexport oficu_provider_blob::export
- enables the
fs_exporter
- enables the
fs_exporter
module, a reexport oficu_provider_fs::export
- enables the
rayon
- enables parallelism during export
Modules§
- baked_
exporter - A data exporter that bakes the data into Rust code.
- blob_
exporter - Data exporter that creates a binary blob for use with
BlobDataProvider
. - fs_
exporter - Data exporter that creates a file system structure for use with
FsDataProvider
. - prelude
- A prelude for using the datagen API
Structs§
- Data
Locale Family - A family of locales to export.
- Export
Driver - Configuration for a data export operation.
- Export
Metadata - Contains information about a successful export.
- Fallback
Options - Options bag configuring locale inclusion and behavior when runtime fallback is enabled.
- NoFallback
Options - Options bag configuring locale inclusion and behavior when runtime fallback is disabled.
Enums§
- Data
Locale Family Parse Error - An error while parsing a
DataLocaleFamily
. - Deduplication
Strategy - Choices for determining the deduplication of locales for exported data payloads.