Skip to main content

PageNumberResolver

Struct PageNumberResolver 

Source
pub struct PageNumberResolver { /* private fields */ }
Expand description

Tracks page numbers for elements with IDs and resolves page-number-citations

Implementations§

Source§

impl PageNumberResolver

Source

pub fn new() -> Self

Create a new page number resolver

Source

pub fn set_current_page(&mut self, page: usize)

Set the current page number

Source

pub fn current_page(&self) -> usize

Get the current page number

Source

pub fn set_current_format(&mut self, format: String)

Set the current page number format

Source

pub fn current_format(&self) -> &str

Get the current page number format

Source

pub fn register_element(&mut self, id: String, area_id: AreaId)

Register an element with an ID on the current page

Source

pub fn get_format_for_id(&self, id: &str) -> Option<&str>

Get the page number format that was active when the element was registered

Source

pub fn set_current_grouping_separator(&mut self, sep: Option<char>)

Set the current grouping separator

Source

pub fn current_grouping_separator(&self) -> Option<char>

Get the current grouping separator

Source

pub fn set_current_grouping_size(&mut self, size: Option<usize>)

Set the current grouping size

Source

pub fn current_grouping_size(&self) -> Option<usize>

Get the current grouping size

Source

pub fn register_citation(&mut self, area_id: AreaId, ref_id: String)

Register a page-number-citation that needs to be resolved

Source

pub fn get_page_number(&self, ref_id: &str) -> Option<usize>

Get the page number for a referenced element

Source

pub fn get_citations(&self) -> &[(AreaId, String)]

Get all citations that need to be resolved

Source

pub fn can_resolve_all(&self) -> bool

Check if all citations can be resolved

Source

pub fn unresolved_citations(&self) -> Vec<String>

Get a list of unresolved citations

Source

pub fn clear(&mut self)

Clear all registered data (for a new layout pass)

Trait Implementations§

Source§

impl Default for PageNumberResolver

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
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.