Skip to main content

window_from

Function window_from 

Source
pub fn window_from(text: &str, offset: usize) -> &str
Expand description

The remainder of text from a byte offset, for reading a long document a window at a time.

The offset is clamped to the document and snapped back to a character boundary, so an offset from any source is safe to pass: a caller that resumes from a stale or hand-written position gets a shorter window, never a panic. Offsets address the extracted text, not the source bytes, so they stay stable across output formats of the same document.