pub struct SectionedHeader {
pub first_page: Option<InstitutionalHeader>,
pub odd_pages: Option<InstitutionalHeader>,
pub even_pages: Option<InstitutionalHeader>,
}Expand description
Header configuration with per-section variants.
Allows different headers for the first page, odd pages, and even pages, matching the Word document model.
§Example
use normordis_pdf::{SectionedHeader, InstitutionalHeader};
let header = SectionedHeader::new()
.first_page(
InstitutionalHeader::new("Câmara Municipal", "Ofício")
.with_reference("REF/2026/001")
)
.odd_pages(
InstitutionalHeader::new("Câmara Municipal", "Ofício — continuação")
);Fields§
§first_page: Option<InstitutionalHeader>§odd_pages: Option<InstitutionalHeader>§even_pages: Option<InstitutionalHeader>Implementations§
Source§impl SectionedHeader
impl SectionedHeader
pub fn new() -> Self
Sourcepub fn first_page(self, h: InstitutionalHeader) -> Self
pub fn first_page(self, h: InstitutionalHeader) -> Self
Sets the header for the first page only.
Sourcepub fn odd_pages(self, h: InstitutionalHeader) -> Self
pub fn odd_pages(self, h: InstitutionalHeader) -> Self
Sets the header for odd pages (1, 3, 5, …).
Also used as fallback when even_pages is not set.
Sourcepub fn even_pages(self, h: InstitutionalHeader) -> Self
pub fn even_pages(self, h: InstitutionalHeader) -> Self
Sets the header for even pages (2, 4, 6, …).
Sourcepub fn resolve(&self, page_number: u32) -> Option<&InstitutionalHeader>
pub fn resolve(&self, page_number: u32) -> Option<&InstitutionalHeader>
Resolves which header to render for a given page number (1-based).
Resolution order:
- page == 1 AND first_page.is_some() → first_page
- page is even AND even_pages.is_some() → even_pages
- odd_pages.is_some() → odd_pages
- None (no header for this page)
Trait Implementations§
Source§impl Clone for SectionedHeader
impl Clone for SectionedHeader
Source§fn clone(&self) -> SectionedHeader
fn clone(&self) -> SectionedHeader
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 SectionedHeader
impl Debug for SectionedHeader
Source§impl Default for SectionedHeader
impl Default for SectionedHeader
Source§fn default() -> SectionedHeader
fn default() -> SectionedHeader
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SectionedHeader
impl RefUnwindSafe for SectionedHeader
impl Send for SectionedHeader
impl Sync for SectionedHeader
impl Unpin for SectionedHeader
impl UnsafeUnpin for SectionedHeader
impl UnwindSafe for SectionedHeader
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
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§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
Convert this type into
T, using the provided data to resolve any offsets.