impl LineSegmenter { /// Construct a [`LineSegmenter`] with default options (no locale-based tailoring) using compiled data. It automatically loads the best /// available payload data for Burmese, Khmer, Lao, and Thai. #[diplomat::rust_link(icu::segmenter::LineSegmenter::new_auto, FnInStruct)] #[diplomat::attr(auto, named_constructor = "auto")] #[cfg(feature = "compiled_data")] pubfn create_auto() -> Box<LineSegmenter> { Box::new(LineSegmenter(
icu_segmenter::LineSegmenter::new_auto(Default::default()).static_to_owned(),
))
}
/// Construct a [`LineSegmenter`] with default options (no locale-based tailoring) and LSTM payload data for /// Burmese, Khmer, Lao, and Thai, using compiled data. #[diplomat::rust_link(icu::segmenter::LineSegmenter::new_lstm, FnInStruct)] #[diplomat::attr(auto, named_constructor = "lstm")] #[cfg(feature = "compiled_data")] pubfn create_lstm() -> Box<LineSegmenter> { Box::new(LineSegmenter(
icu_segmenter::LineSegmenter::new_lstm(Default::default()).static_to_owned(),
))
}
/// Construct a [`LineSegmenter`] with default options (no locale-based tailoring) and dictionary payload data for /// Burmese, Khmer, Lao, and Thai, using compiled data #[diplomat::rust_link(icu::segmenter::LineSegmenter::new_dictionary, FnInStruct)] #[diplomat::attr(auto, named_constructor = "dictionary")] #[cfg(feature = "compiled_data")] pubfn create_dictionary() -> Box<LineSegmenter> { Box::new(LineSegmenter(
icu_segmenter::LineSegmenter::new_dictionary(Default::default()).static_to_owned(),
))
}
/// Construct a [`LineSegmenter`] with custom options using compiled data. It automatically loads the best /// available payload data for Burmese, Khmer, Lao, and Thai. #[diplomat::rust_link(icu::segmenter::LineSegmenter::new_auto, FnInStruct)] #[diplomat::attr(supports = non_exhaustive_structs, rename = "auto_with_options")] #[diplomat::attr(all(supports = non_exhaustive_structs, supports = named_constructors), named_constructor = "auto_with_options")] #[diplomat::attr(all(not(supports = non_exhaustive_structs), supports = named_constructors), named_constructor = "auto_with_options_v2")] #[cfg(feature = "compiled_data")] pubfn create_auto_with_options_v2(
content_locale: Option<&Locale>,
options: LineBreakOptionsV2,
) -> Box<LineSegmenter> { letmut options: LineBreakOptions = options.into();
options.content_locale = content_locale.map(|c| &c.0.id); Box::new(LineSegmenter(
icu_segmenter::LineSegmenter::new_auto(options).static_to_owned(),
))
} /// Construct a [`LineSegmenter`] with custom options. It automatically loads the best /// available payload data for Burmese, Khmer, Lao, and Thai, using a particular data source. #[diplomat::rust_link(icu::segmenter::LineSegmenter::new_auto, FnInStruct)] #[diplomat::attr(supports = non_exhaustive_structs, rename = "auto_with_options_and_provider")] #[diplomat::attr(all(supports = non_exhaustive_structs, supports = fallible_constructors, supports = named_constructors), named_constructor = "auto_with_options_and_provider")] #[diplomat::attr(all(not(supports = non_exhaustive_structs), supports = fallible_constructors, supports = named_constructors), named_constructor = "auto_with_options_v2_and_provider")] #[cfg(feature = "buffer_provider")] pubfn create_auto_with_options_v2_and_provider(
provider: &DataProvider,
content_locale: Option<&Locale>,
options: LineBreakOptionsV2,
) -> Result<Box<LineSegmenter>, DataError> { letmut options: LineBreakOptions = options.into();
options.content_locale = content_locale.map(|c| &c.0.id);
impl<'a> LineBreakIteratorUtf8<'a> { /// Finds the next breakpoint. Returns -1 if at the end of the string or if the index is /// out of range of a 32-bit signed integer. #[diplomat::rust_link(icu::segmenter::iterators::LineBreakIterator::next, FnInStruct)] pubfn next(&mutself) -> i32 { self.0
.next()
.and_then(|u| i32::try_from(u).ok())
.unwrap_or(-1)
}
}
impl<'a> LineBreakIteratorUtf16<'a> { /// Finds the next breakpoint. Returns -1 if at the end of the string or if the index is /// out of range of a 32-bit signed integer. #[diplomat::rust_link(icu::segmenter::iterators::LineBreakIterator::next, FnInStruct)] #[diplomat::rust_link(
icu::segmenter::iterators::LineBreakIterator::Item,
AssociatedTypeInStruct,
hidden
)] pubfn next(&mutself) -> i32 { self.0
.next()
.and_then(|u| i32::try_from(u).ok())
.unwrap_or(-1)
}
}
impl<'a> LineBreakIteratorLatin1<'a> { /// Finds the next breakpoint. Returns -1 if at the end of the string or if the index is /// out of range of a 32-bit signed integer. #[diplomat::rust_link(icu::segmenter::iterators::LineBreakIterator::next, FnInStruct)] #[diplomat::rust_link(
icu::segmenter::iterators::LineBreakIterator::Item,
AssociatedTypeInStruct,
hidden
)] pubfn next(&mutself) -> i32 { self.0
.next()
.and_then(|u| i32::try_from(u).ok())
.unwrap_or(-1)
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.