pub struct BreakCursor<'a> {
pub items: &'a [ShapedItem],
pub next_item_index: usize,
pub partial_remainder: Vec<ShapedItem>,
}Fields§
§items: &'a [ShapedItem]A reference to the complete list of shaped items.
next_item_index: usizeThe index of the next full item to be processed from the items slice.
partial_remainder: Vec<ShapedItem>The remainder of an item that was split by hyphenation on the previous line. This will be the very first piece of content considered for the next line.
Implementations§
Source§impl<'a> BreakCursor<'a>
impl<'a> BreakCursor<'a>
pub fn new(items: &'a [ShapedItem]) -> Self
Sourcepub fn is_at_start(&self) -> bool
pub fn is_at_start(&self) -> bool
Checks if the cursor is at the very beginning of the content stream.
Sourcepub fn drain_remaining(&mut self) -> Vec<ShapedItem>
pub fn drain_remaining(&mut self) -> Vec<ShapedItem>
Consumes the cursor and returns all remaining items as a Vec.
Sourcepub fn is_done(&self) -> bool
pub fn is_done(&self) -> bool
Checks if all content, including any partial remainders, has been processed.
Sourcepub fn peek_next_unit(&self) -> Vec<ShapedItem>
pub fn peek_next_unit(&self) -> Vec<ShapedItem>
Looks ahead and returns the next “unbreakable” unit of content. This is typically a word (a series of non-space clusters) followed by a space, or just a single space if that’s next.
Auto Trait Implementations§
impl<'a> Freeze for BreakCursor<'a>
impl<'a> RefUnwindSafe for BreakCursor<'a>
impl<'a> Send for BreakCursor<'a>
impl<'a> Sync for BreakCursor<'a>
impl<'a> Unpin for BreakCursor<'a>
impl<'a> UnwindSafe for BreakCursor<'a>
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
Mutably borrows from an owned value. Read more
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>
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 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>
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