pub struct CrossReferenceIndex { /* private fields */ }Expand description
A cross-reference index for the entire document.
Implementations§
Source§impl CrossReferenceIndex
impl CrossReferenceIndex
Sourcepub fn from_pages(pages: &[Vec<ContentElement>]) -> Self
pub fn from_pages(pages: &[Vec<ContentElement>]) -> Self
Build a cross-reference index from document pages.
Sourcepub fn find_by_heading(&self, query: &str) -> Vec<(usize, &XRefEntry)>
pub fn find_by_heading(&self, query: &str) -> Vec<(usize, &XRefEntry)>
Find elements by heading text (case-insensitive substring match).
Sourcepub fn elements_on_page(&self, page_number: u32) -> Vec<(usize, &XRefEntry)>
pub fn elements_on_page(&self, page_number: u32) -> Vec<(usize, &XRefEntry)>
Get all elements on a given page.
Sourcepub fn heading_count(&self) -> usize
pub fn heading_count(&self) -> usize
Number of headings indexed.
Sourcepub fn page_count(&self) -> usize
pub fn page_count(&self) -> usize
Number of pages with indexed elements.
Trait Implementations§
Source§impl Clone for CrossReferenceIndex
impl Clone for CrossReferenceIndex
Source§fn clone(&self) -> CrossReferenceIndex
fn clone(&self) -> CrossReferenceIndex
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 moreAuto Trait Implementations§
impl Freeze for CrossReferenceIndex
impl RefUnwindSafe for CrossReferenceIndex
impl Send for CrossReferenceIndex
impl Sync for CrossReferenceIndex
impl Unpin for CrossReferenceIndex
impl UnsafeUnpin for CrossReferenceIndex
impl UnwindSafe for CrossReferenceIndex
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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