| Crates.io | icu_datagen |
| lib.rs | icu_datagen |
| version | 1.5.0 |
| created_at | 2021-11-02 00:25:56.752827+00 |
| updated_at | 2024-05-28 20:22:35.271555+00 |
| description | Generate data for ICU4X DataProvider |
| homepage | https://icu4x.unicode.org |
| repository | https://github.com/unicode-org/icu4x |
| max_upload_size | |
| id | 475525 |
| size | 35,509,839 |
icu_datagen is a library to generate data files that can be used in ICU4X data providers.
Data files can be generated either programmatically (i.e. in build.rs), or through a
command-line utility.
Also see our datagen tutorial.
use icu_datagen::blob_exporter::*;
use icu_datagen::prelude::*;
use std::fs::File;
DatagenDriver::new()
.with_keys([icu::list::provider::AndListV1Marker::KEY])
.with_locales_and_fallback([LocaleFamily::FULL], Default::default())
.export(
&DatagenProvider::new_latest_tested(),
BlobExporter::new_v2_with_sink(Box::new(
File::create("data.postcard").unwrap(),
)),
)
.unwrap();
The command line interface can be installed through Cargo.
$ cargo install icu_datagen
Once the tool is installed, you can invoke it like this:
$ icu4x-datagen --keys all --locales de en-AU --format blob --out data.postcard
More details can be found by running --help.
This crate has a lot of dependencies, some of which are not required for all operating modes. These default Cargo features can be disabled to reduce dependencies:
baked_exporter
baked_exporter] module--format mod CLI argumentblob_exporter
blob_exporter] module, a reexport of [icu_provider_blob::export]--format blob CLI argumentfs_exporter
fs_exporter] module, a reexport of [icu_provider_fs::export]--format dir CLI argumentnetworking
DatagenProvider] that fetch source data from the network--cldr-tag, --icu-export-tag, and --segmenter-lstm-tag CLI arguments that download datarayon
use_wasm / use_icu4c
icu_codepointtrie_builderbin
cargo install worklegacy_api
icu_experimental
icu_experimental crateall_keysThe meta-feature experimental_components is available to activate all experimental components.
For more information on development, authorship, contributing etc. please visit ICU4X home page.