pub struct PaginationContext {
pub byte_offset: usize,
pub event_index: usize,
pub element_stack: Vec<String>,
pub text_accumulator: String,
pub page_number: usize,
}Expand description
Stateful pagination context for resumable page layout.
Tracks parsing/layout state so page N+1 can continue from where page N left off without re-parsing from the start.
Fields§
§byte_offset: usizeCurrent byte offset in the source document.
event_index: usizeCurrent event/token index.
element_stack: Vec<String>Current element stack (path from root to current element).
text_accumulator: StringAccumulated text since last page break.
page_number: usizeCurrent page number.
Implementations§
Source§impl PaginationContext
impl PaginationContext
Sourcepub fn advance_bytes(&mut self, bytes: usize)
pub fn advance_bytes(&mut self, bytes: usize)
Update byte offset.
Sourcepub fn advance_events(&mut self, events: usize)
pub fn advance_events(&mut self, events: usize)
Update event index.
Sourcepub fn push_element(&mut self, tag: &str)
pub fn push_element(&mut self, tag: &str)
Push element onto stack.
Sourcepub fn pop_element(&mut self) -> Option<String>
pub fn pop_element(&mut self) -> Option<String>
Pop element from stack.
Sourcepub fn append_text(&mut self, text: &str, max_len: usize)
pub fn append_text(&mut self, text: &str, max_len: usize)
Accumulate text.
Trait Implementations§
Source§impl Clone for PaginationContext
impl Clone for PaginationContext
Source§fn clone(&self) -> PaginationContext
fn clone(&self) -> PaginationContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PaginationContext
impl Debug for PaginationContext
Auto Trait Implementations§
impl Freeze for PaginationContext
impl RefUnwindSafe for PaginationContext
impl Send for PaginationContext
impl Sync for PaginationContext
impl Unpin for PaginationContext
impl UnsafeUnpin for PaginationContext
impl UnwindSafe for PaginationContext
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