[−][src]Struct xi_unicode::LineBreakLeafIter
A class (TODO, not right word) useful for computing line breaks in a rope or other non-contiguous string representation. This is a trickier problem than iterating in a string for a few reasons, the trickiest of which is that in the general case, line breaks require an indeterminate amount of look-behind.
This is something of an "expert-level" interface, and should only be used if the caller is prepared to respect all the invariants. Otherwise, you might get inconsistent breaks depending on start positiona and leaf boundaries.
Implementations
impl LineBreakLeafIter
[src]
pub fn new(s: &str, ix: usize) -> LineBreakLeafIter
[src]
Create a new line break iterator suitable for leaves in a rope. Precondition: ix is at a code point boundary within s.
pub fn next(&mut self, s: &str) -> (usize, bool)
[src]
Return break pos and whether it's a hard break. Note: hard break indication may go away, this may not be useful in actual application. If end of leaf is found, return leaf's len. This does not indicate a break, as that requires at least one more codepoint of context. If it is a break, then subsequent next call will return an offset of 0. EOT is always a break, so in the EOT case it's up to the caller to figure that out.
For consistent results, always supply same s
until end of leaf is
reached (and initially this should be the same as in the new
call).
Trait Implementations
impl Clone for LineBreakLeafIter
[src]
fn clone(&self) -> LineBreakLeafIter
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for LineBreakLeafIter
[src]
impl Default for LineBreakLeafIter
[src]
fn default() -> LineBreakLeafIter
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,