pub struct OutlineEntry {
pub title: String,
pub page: Option<String>,
pub level: u8,
pub entry_type: Option<String>,
pub children: Vec<OutlineEntry>,
}Expand description
A hierarchical table of contents entry that can represent various Outline structures
This flexible model can handle:
- Simple flat TOCs: title + page
- Chapter-based TOCs: chapters with subsections
- Part-based TOCs: parts with chapters with sections
- Mixed hierarchies: any combination of the above
Fields§
§title: StringThe title/heading text (required)
page: Option<String>Page number or range (e.g., “15”, “15-20”, “iv”, “A-1”) Optional because some entries might be section dividers
level: u8Hierarchical level (0 = top level, 1 = subsection, etc.) Helps maintain structure without complex nesting
entry_type: Option<String>Optional type/category for semantic meaning Examples: “part”, “chapter”, “section”, “appendix”, “index”
children: Vec<OutlineEntry>Child entries for hierarchical structures Empty for leaf entries
Implementations§
Source§impl OutlineEntry
impl OutlineEntry
pub fn new(title: String, page: Option<String>, level: u8) -> Self
pub fn with_type(self, entry_type: String) -> Self
pub fn with_children(self, children: Vec<OutlineEntry>) -> Self
Sourcepub fn add_child(&mut self, child: OutlineEntry)
pub fn add_child(&mut self, child: OutlineEntry)
Add a child entry
Sourcepub fn flatten(&self) -> Vec<FlatOutlineEntry>
pub fn flatten(&self) -> Vec<FlatOutlineEntry>
Get all entries flattened with their hierarchical context
Trait Implementations§
Source§impl Clone for OutlineEntry
impl Clone for OutlineEntry
Source§fn clone(&self) -> OutlineEntry
fn clone(&self) -> OutlineEntry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OutlineEntry
impl Debug for OutlineEntry
Source§impl<'de> Deserialize<'de> for OutlineEntry
impl<'de> Deserialize<'de> for OutlineEntry
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for OutlineEntry
impl RefUnwindSafe for OutlineEntry
impl Send for OutlineEntry
impl Sync for OutlineEntry
impl Unpin for OutlineEntry
impl UnsafeUnpin for OutlineEntry
impl UnwindSafe for OutlineEntry
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