pub struct HeaderFooter {
pub paragraphs: Vec<Paragraph>,
pub apply_page_type: ApplyPageType,
}Expand description
A header or footer region containing paragraphs.
In HWPX, headers and footers appear as <hp:header> / <hp:footer>
elements inside <hp:ctrl> in the section body. Each contains its own
paragraphs and an ApplyPageType controlling which pages it applies to.
§Examples
use hwpforge_core::section::HeaderFooter;
use hwpforge_core::paragraph::Paragraph;
use hwpforge_foundation::{ApplyPageType, ParaShapeIndex};
let hf = HeaderFooter::new(
vec![Paragraph::new(ParaShapeIndex::new(0))],
ApplyPageType::Both,
);
assert_eq!(hf.paragraphs.len(), 1);
assert_eq!(hf.apply_page_type, ApplyPageType::Both);Fields§
§paragraphs: Vec<Paragraph>Paragraphs composing the header/footer content.
apply_page_type: ApplyPageTypeWhich pages this header/footer applies to.
Implementations§
Sourcepub fn new(paragraphs: Vec<Paragraph>, apply_page_type: ApplyPageType) -> Self
pub fn new(paragraphs: Vec<Paragraph>, apply_page_type: ApplyPageType) -> Self
Creates a new header/footer with the given paragraphs and page scope.
Sourcepub fn all_pages(paragraphs: Vec<Paragraph>) -> Self
pub fn all_pages(paragraphs: Vec<Paragraph>) -> Self
Creates a header/footer applied to all pages (both odd and even).
This is the most common case for simple documents that use a single header or footer on every page.
§Examples
use hwpforge_core::section::HeaderFooter;
use hwpforge_core::paragraph::Paragraph;
use hwpforge_foundation::{ApplyPageType, ParaShapeIndex};
let hf = HeaderFooter::all_pages(vec![Paragraph::new(ParaShapeIndex::new(0))]);
assert_eq!(hf.apply_page_type, ApplyPageType::Both);
assert_eq!(hf.paragraphs.len(), 1);Trait Implementations§
Source§fn clone(&self) -> HeaderFooter
fn clone(&self) -> HeaderFooter
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§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
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreAuto Trait Implementations§
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