Struct icu_provider_export::ExportDriver

source ·
pub struct ExportDriver { /* private fields */ }
Expand description

Configuration for a data export operation.

Note that this only configures which data is exported. The input provider, usually SourceDataProvider, might expose more options about the data itself.

§Examples

use icu_provider_export::blob_exporter::*;
use icu_provider_export::prelude::*;
use icu_provider_source::SourceDataProvider;

let provider = SourceDataProvider::new_latest_tested();

ExportDriver::new([DataLocaleFamily::FULL], DeduplicationStrategy::None.into(), LocaleFallbacker::try_new_unstable(&provider).unwrap())
    .with_markers([icu::list::provider::AndListV2Marker::INFO])
    .export(
        &provider,
        BlobExporter::new_with_sink(Box::new(&mut Vec::new())),
    )
    .unwrap();

Implementations§

source§

impl ExportDriver

source

pub fn new( locales: impl IntoIterator<Item = DataLocaleFamily>, options: FallbackOptions, fallbacker: LocaleFallbacker, ) -> Self

Creates a ExportDriver.

The fallbacker is used to resolve locale families, and to dedpulicate data if requested. Make sure to use the same fallback data when loading from the provider at runtime. Commonly, you will export the fallback markers, in which case you should construct your fallbacker with the source provider (i.e. [LocaleFallbacker::try_new_unstable]).

source

pub fn with_marker_attributes_filter( self, domain: &str, filter: impl Fn(&DataMarkerAttributes) -> bool + Send + Sync + 'static, ) -> Self

TODO

source

pub fn with_markers( self, markers: impl IntoIterator<Item = DataMarkerInfo>, ) -> Self

Sets this driver to generate the given data markers.

If this is not called, all markers supported by the provider will be exported.

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 markers.

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 markers.

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<ExportMetadata, DataError>

Exports data from the given provider to the given exporter.

See make_exportable_provider!, BlobExporter, FileSystemExporter, and BakedExporter.

Trait Implementations§

source§

impl Clone for ExportDriver

source§

fn clone(&self) -> ExportDriver

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 ExportDriver

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
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
source§

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

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

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
source§

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

source§

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>,

source§

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>,

source§

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> ErasedDestructor for T
where T: 'static,

§

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