pub struct NavPoint {
pub label: String,
pub content: Option<PathBuf>,
pub children: Vec<NavPoint>,
pub play_order: Option<usize>,
}Expand description
Represents a navigation point in an EPUB document’s table of contents
The NavPoint structure represents a single entry in the hierarchical table of contents
of an EPUB publication. Each navigation point corresponds to a section or chapter in
the publication and may contain nested child navigation points to represent sub-sections.
§Builder Methods
When the builder feature is enabled, this struct provides convenient builder methods:
use lib_epub::types::NavPoint;
let nav_point = NavPoint::new("Chapter 1")
.with_content("chapter1.xhtml")
.append_child(
NavPoint::new("Section 1.1")
.with_content("section1_1.xhtml")
.build()
)
.build();Fields§
§label: StringThe display label/title of this navigation point
This is the text that should be displayed to users in the table of contents.
content: Option<PathBuf>The content document path this navigation point references
Can be None for navigation points that no relevant information was
provided in the original data.
children: Vec<NavPoint>Child navigation points (sub-sections)
play_order: Option<usize>The reading order position of this navigation point
It can be None for navigation points that no relevant information was
provided in the original data.
Implementations§
Sourcepub fn new(label: &str) -> Self
pub fn new(label: &str) -> Self
Creates a new navigation point with the given label
Requires the builder feature.
§Parameters
label- The display label for this navigation point
Sourcepub fn with_content(&mut self, content: &str) -> &mut Self
pub fn with_content(&mut self, content: &str) -> &mut Self
Sets the content path for this navigation point
Requires the builder feature.
§Parameters
content- The path to the content document
Sourcepub fn append_child(&mut self, child: NavPoint) -> &mut Self
pub fn append_child(&mut self, child: NavPoint) -> &mut Self
Appends a child navigation point
Requires the builder feature.
§Parameters
child- The child navigation point to add
Sourcepub fn set_children(&mut self, children: Vec<NavPoint>) -> &mut Self
pub fn set_children(&mut self, children: Vec<NavPoint>) -> &mut Self
Sets all child navigation points
Requires the builder feature.
§Parameters
children- Vector of child navigation points
Trait Implementations§
Auto Trait Implementations§
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.