pub struct TableOfContents {
pub max_depth: u8,
pub style: TextStyle,
pub leader: char,
pub skip: usize,
pub common: Common,
}Expand description
Self-populating from every Text::outline_level/.heading1()-etc.
heading in the document (the same source the PDF bookmark sidebar is
built from), with correct page numbers — the two-pass layout already
determines those in pass 1, this element just renders them in pass 2
(see lightweight-pdf-layout::toc). Entries are always left-aligned,
one per line, indented by heading depth, with a leader (.leader())
filling the gap to a right-hand page number; .style controls
font/size/color for every entry uniformly.
Fields§
§max_depth: u8Only headings at this outline_level or shallower become entries
(default 3).
style: TextStyle§leader: charCharacter repeated between an entry’s title and its page number
(default .); set to ' ' for no visible leader.
skip: usizeInternal: how many matching headings to skip before this
instance’s first entry. Set only by the layout crate when a
TableOfContents itself splits across a page boundary — always
0 on one an author constructs.
common: CommonImplementations§
Source§impl TableOfContents
impl TableOfContents
pub fn new() -> Self
pub fn max_depth(self, depth: u8) -> Self
pub fn leader(self, leader: char) -> Self
pub fn style(self, style: TextStyle) -> Self
pub fn width(self, width: f32) -> Self
pub fn height(self, height: f32) -> Self
pub fn flex(self, factor: f32) -> Self
pub fn padding(self, padding: f32) -> Self
pub fn corner_radius(self, radius: f32) -> Self
pub fn overflow(self, overflow: Overflow) -> Self
pub fn background(self, color: Color) -> Self
pub fn border(self, border: Border) -> Self
Sourcepub fn keep_with_next(self) -> Self
pub fn keep_with_next(self) -> Self
See plan/05-overflow-and-robustness.md Grundprinzip 9: only
placed on a page if the following sibling also still fits.
Trait Implementations§
Source§impl Clone for TableOfContents
impl Clone for TableOfContents
Source§fn clone(&self) -> TableOfContents
fn clone(&self) -> TableOfContents
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more