[][src]Struct rust_icu_ubrk::UBreakIterator

pub struct UBreakIterator { /* fields omitted */ }

Rust wrapper for the ICU UBreakIterator type.

Implementations

impl UBreakIterator[src]

pub fn available_locales() -> Locales

Notable traits for Locales

impl Iterator for Locales type Item = ULoc;
[src]

Returns an iterator over the locales for which text breaking information is available.

Implements ubrk_countAvailable.

pub fn try_new(
    type_: UBreakIteratorType,
    locale: &str,
    text: &str
) -> Result<Self, Error>
[src]

Creates a new break iterator with the specified type (character, word, line, or sentence) in the specified locale over text.

Implements ubrk_open.

pub fn try_new_ustring(
    type_: UBreakIteratorType,
    locale: &ULoc,
    text: &UChar
) -> Result<Self, Error>
[src]

Implements ubrk_open.

pub fn try_new_rules(rules: &str, text: &str) -> Result<Self, Error>[src]

Creates a new break iterator using the specified breaking rules.

See the ICU user guide for rules syntax.

Implements ubrk_openRules.

pub fn try_new_rules_ustring(rules: &UChar, text: &UChar) -> Result<Self, Error>[src]

Implements ubrk_openRules.

pub fn try_new_binary_rules(rules: &Vec<u8>, text: &str) -> Result<Self, Error>[src]

Creates a new break iterator using pre-compiled binary rules.

Binary rules can be obtained with get_binary_rules.

Implements ubrk_openBinaryRules.

pub fn try_new_binary_rules_ustring(
    rules: &Vec<u8>,
    text: &UChar
) -> Result<Self, Error>
[src]

Implements ubrk_openBinaryRules.

pub fn get_binary_rules(&self) -> Result<Vec<u8>, Error>[src]

Returns a Vec<u8> containing the compiled binary version of the rules specifying the behavior of this break iterator.

Implements ubrk_getBinaryRules.

pub fn safe_clone(&self) -> Result<Self, Error>[src]

Performs a clone of the underlying representation.

The cloned break iterator will hold pointers to the same text, and rules, binary rules, or locale, as the original break iterator. The clone's underlying C representation will maintain its own independent iteration state, but it will be initialized to that of the original (so, for example, if self.current() == 11, then self.safe_clone().current() == 11).

Note that the Clone trait was not implemented as the underlying operation may fail.

Implements ubrk_safeClone.

pub fn set_text(&mut self, text: &str) -> Result<(), Error>[src]

Instructs this break iterator to point to a new piece of text.

Implements ubrk_setText.

pub fn set_text_ustring(&mut self, text: &UChar) -> Result<(), Error>[src]

Implements ubrk_setText.

pub fn current(&self) -> i32[src]

Reports the most recently-returned text boundary.

Implements ubrk_current.

pub fn previous(&self) -> Option<i32>[src]

Sets the break iterator's position to the boundary preceeding its current position.

Implements ubrk_previous.

pub fn first(&self) -> i32[src]

Moves the iterator to the beginning of its text and returns the new position (zero).

Implements ubrk_first.

pub fn last_boundary(&self) -> i32[src]

Moves the iterator to the position immediately beyond the last character in its text and returns the new position.

Named as such so as to avoid conflict with the last method provided by Iterator.

Implements ubrk_last.

pub fn preceding(&self, offset: i32) -> i32[src]

Moves the iterator to the boundary immediately preceding the specified offset and returns the new position.

Implements ubrk_preceding.

pub fn following(&self, offset: i32) -> i32[src]

Moves the iterator to the boundary immediately following the specified offset and returns the new position.

Implements ubrk_following.

pub fn is_boundary(&self, offset: i32) -> bool[src]

Reports whether the specified offset is a boundary.

Implements ubrk_isBoundary.

pub fn get_locale_by_type(
    &self,
    type_: ULocDataLocaleType
) -> Result<String, Error>
[src]

Returns the locale, valid or actual, of this break iterator.

Implements ubrk_getLocaleByType.

pub fn get_rule_status(&self) -> i32[src]

Returns the status of the break rule that determined the most-recently returned boundary. The default status for rules that do not explicitly provide one is zero.

See the ICU user guide for details on rule syntax and rule status values.

Implements ubrk_getRuleStatus.

pub fn get_rule_status_vec(&self) -> Result<Vec<i32>, Error>[src]

Returns the statuses of the break rules that determined the most-recently returned boundary. The default status for rules that do not explicitly provide one is zero.

See the ICU user guide for details on rule syntax and rule status values.

Implements ubrk_getRuleStatusVec.

Trait Implementations

impl Drop for UBreakIterator[src]

fn drop(&mut self)[src]

Implements $impl_function_name.

impl Iterator for UBreakIterator[src]

type Item = i32

The type of the elements being iterated over.

fn next(&mut self) -> Option<Self::Item>[src]

Advances the break iterator's position to the next boundary after its current position.

Note that ubrk_next will never return the first boundary. For example, given a newly-initialized break iterator whose internal position is 0, the first invocation of next will return the next boundary, not 0. If the caller requires the first boundary, it should utilize first.

Also note that interleaving calls to first, last_boundary, previous, preceding, or following may change the break iterator's internal position, thereby affecting the next value returned by next.

Implements ubrk_next.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.