pub struct PdfBookmarks<'a> { /* private fields */ }Expand description
The bookmarks contained within a single PdfDocument.
Bookmarks in PDF files form a tree structure, branching out from a top-level root bookmark.
The PdfBookmarks::root() returns the root bookmark in the containing PdfDocument, if any;
use the root’s PdfBookmark::first_child() and PdfBookmark::next_sibling() functions to
traverse the bookmark tree.
To search the tree for a bookmark with a specific title, use the PdfBookmarks::find_first_by_title() and PdfBookmarks::find_all_by_title() functions. To traverse the tree breadth-first, visiting every bookmark in the tree, create an iterator using the PdfBookmarks::iter() function.
Implementations§
Source§impl<'a> PdfBookmarks<'a>
impl<'a> PdfBookmarks<'a>
Sourcepub fn bindings(&self) -> &'a dyn PdfiumLibraryBindings
pub fn bindings(&self) -> &'a dyn PdfiumLibraryBindings
Returns the PdfiumLibraryBindings used by this PdfBookmarks collection.
Sourcepub fn root(&self) -> Option<PdfBookmark<'_>>
pub fn root(&self) -> Option<PdfBookmark<'_>>
Returns the root PdfBookmark in the containing PdfDocument, if any.
Sourcepub fn find_first_by_title(
&self,
title: &str,
) -> Result<PdfBookmark<'_>, PdfiumError>
pub fn find_first_by_title( &self, title: &str, ) -> Result<PdfBookmark<'_>, PdfiumError>
Returns the first PdfBookmark in the containing PdfDocument that has a title matching
the given string.
Note that bookmarks are not required to have unique titles, so in theory any number of bookmarks could match a given title. This function only ever returns the first. To return all matches, use PdfBookmarks::find_all_by_title().
Sourcepub fn find_all_by_title(&self, title: &str) -> Vec<PdfBookmark<'_>>
pub fn find_all_by_title(&self, title: &str) -> Vec<PdfBookmark<'_>>
Returns all PdfBookmark objects in the containing PdfDocument that have a title
matching the given string.
Note that bookmarks are not required to have unique titles, so in theory any number of bookmarks could match a given title. This function returns all matches by performing a complete breadth-first traversal of the entire bookmark tree. To return just the first match, use PdfBookmarks::find_first_by_title().
Sourcepub fn iter(&self) -> PdfBookmarksIterator<'_> ⓘ
pub fn iter(&self) -> PdfBookmarksIterator<'_> ⓘ
Returns a depth-first prefix-order iterator over all the PdfBookmark
objects in the containing PdfDocument, starting from the top-level
root bookmark.
Auto Trait Implementations§
impl<'a> Freeze for PdfBookmarks<'a>
impl<'a> !RefUnwindSafe for PdfBookmarks<'a>
impl<'a> !Send for PdfBookmarks<'a>
impl<'a> !Sync for PdfBookmarks<'a>
impl<'a> Unpin for PdfBookmarks<'a>
impl<'a> !UnwindSafe for PdfBookmarks<'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
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>
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>
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