pub struct PageCounter {
pub page_number: usize,
pub total_pages: Option<usize>,
pub chapter: Option<usize>,
pub named_counters: BTreeMap<String, i32>,
}Expand description
Counter that tracks page numbers and other running content
Fields§
§page_number: usizeCurrent page number (1-indexed)
total_pages: Option<usize>Total page count (may be unknown during first pass)
chapter: Option<usize>Chapter or section number
named_counters: BTreeMap<String, i32>Custom named counters (CSS counter() function)
Implementations§
Source§impl PageCounter
impl PageCounter
pub fn new() -> Self
pub fn with_page_number(self, page: usize) -> Self
pub fn with_total_pages(self, total: usize) -> Self
Sourcepub fn format_page_number(&self, style: PageNumberStyle) -> String
pub fn format_page_number(&self, style: PageNumberStyle) -> String
Format page number as string (e.g., “3”, “iii”, “C”)
Sourcepub fn format_page_of_total(&self) -> String
pub fn format_page_of_total(&self) -> String
Get “Page X of Y” string
Trait Implementations§
Source§impl Clone for PageCounter
impl Clone for PageCounter
Source§fn clone(&self) -> PageCounter
fn clone(&self) -> PageCounter
Returns a duplicate of the value. Read more
1.0.0 · 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 PageCounter
impl Debug for PageCounter
Auto Trait Implementations§
impl Freeze for PageCounter
impl RefUnwindSafe for PageCounter
impl Send for PageCounter
impl Sync for PageCounter
impl Unpin for PageCounter
impl UnwindSafe for PageCounter
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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 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>
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