PdfBookmarks

Struct PdfBookmarks 

Source
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>

Source

pub fn bindings(&self) -> &'a dyn PdfiumLibraryBindings

Returns the PdfiumLibraryBindings used by this PdfBookmarks collection.

Source

pub fn root(&self) -> Option<PdfBookmark<'_>>

Returns the root PdfBookmark in the containing PdfDocument, if any.

Source

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().

Source

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().

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.