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

source

pub fn new() -> Self

Creates an empty DatagenDriver.

Note that keys and locales need to be set before calling export.

source

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.

source

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.

source

pub fn with_all_locales(self) -> Self

Sets this driver to generate all available locales.

source

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.

source

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.

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.

source

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.

source

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

source§

fn clone(&self) -> DatagenDriver

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for DatagenDriver

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

§

fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
source§

impl<T> Filterable for T

source§

fn filterable( self, filter_name: &'static str ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>

Creates a filterable data provider with the given name for debugging. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcastable for T
where T: Any + Send + Sync + 'static,

§

fn upcast_any_ref(&self) -> &(dyn Any + 'static)

upcast ref
§

fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)

upcast mut ref
§

fn upcast_any_box(self: Box<T>) -> Box<dyn Any>

upcast boxed dyn
§

impl<T> Upcastable for T
where T: Any + Debug + 'static,

§

fn upcast_any_ref(&self) -> &(dyn Any + 'static)

§

fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)

§

fn upcast_any_box(self: Box<T>) -> Box<dyn Any>

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T
where T: Send + Sync,