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
impl ExportDriver
sourcepub fn new(
locales: impl IntoIterator<Item = DataLocaleFamily>,
options: FallbackOptions,
fallbacker: LocaleFallbacker,
) -> Self
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
]).
sourcepub fn with_marker_attributes_filter(
self,
domain: &str,
filter: impl Fn(&DataMarkerAttributes) -> bool + Send + Sync + 'static,
) -> Self
pub fn with_marker_attributes_filter( self, domain: &str, filter: impl Fn(&DataMarkerAttributes) -> bool + Send + Sync + 'static, ) -> Self
TODO
sourcepub fn with_markers(
self,
markers: impl IntoIterator<Item = DataMarkerInfo>,
) -> Self
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.
sourcepub fn with_additional_collations(
self,
additional_collations: impl IntoIterator<Item = String>,
) -> Self
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.
sourcepub fn with_recommended_segmenter_models(self) -> Self
pub fn with_recommended_segmenter_models(self) -> Self
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.
sourcepub fn with_segmenter_models(
self,
models: impl IntoIterator<Item = String>,
) -> Self
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.
sourcepub fn export(
self,
provider: &impl ExportableProvider,
sink: impl DataExporter,
) -> Result<ExportMetadata, DataError>
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
impl Clone for ExportDriver
source§fn clone(&self) -> ExportDriver
fn clone(&self) -> ExportDriver
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for ExportDriver
impl !RefUnwindSafe for ExportDriver
impl Send for ExportDriver
impl Sync for ExportDriver
impl Unpin for ExportDriver
impl !UnwindSafe for ExportDriver
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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