Crate icu_datagen
source ·Expand description
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
Examples
build.rs
use icu_datagen::prelude::*;
use std::fs::File;
fn main() {
icu_datagen::datagen(
Some(&[langid!("de"), langid!("en-AU")]),
&[icu::list::provider::AndListV1Marker::KEY],
&SourceData::default(),
vec![Out::Blob(Box::new(File::create("data.postcard").unwrap()))],
)
.unwrap();
}
Command line
The command line interface can be installed through Cargo.
$ cargo install icu4x-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
.
Modules
- A prelude for using the datagen API
- Out::Fs serialization formats.
Structs
- Options for configuring the output of databake.
DataProvider
backed bySourceData
- Bag of options for datagen source data.
Enums
- Specifies the collation Han database to use.
- Specifies a variant of CLDR JSON
- The output format.
Functions
- List of all supported keys, except those that require the “experimental” feature on the
icu
crate. - List of all supported keys, including those that require the “experimental” feature on the
icu
crate. - Runs ICU4X datagen.
- Identifies errors that are due to missing CLDR data.
- Identifies errors that are due to missing ICU export data.
- Parses a human-readable key identifier into a
DataKey
. - Parses a list of human-readable key identifiers and returns a list of
DataKey
s. - Parses a compiled binary and returns a list of
DataKey
s used by it. - Parses a file of human-readable key identifiers and returns a list of
DataKey
s.