pub struct OutputTemplate { /* private fields */ }Expand description
A parsed -o / --output template.
Implementations§
Source§impl OutputTemplate
impl OutputTemplate
Sourcepub fn parse(raw: &str) -> Result<Self, TemplateError>
pub fn parse(raw: &str) -> Result<Self, TemplateError>
Parse a user-supplied -o value.
Recognises %d and %0Nd as the page-number conversion and %% as an
escaped literal %. Every other % sequence is an error, so a typo
like %s is reported rather than silently written to disk.
Sourcepub fn has_page_token(&self) -> bool
pub fn has_page_token(&self) -> bool
Whether this template carries a %d page-number conversion.
Sourcepub fn expand(
&self,
page_number: i32,
emitted_index: u32,
) -> Result<String, ExpandError>
pub fn expand( &self, page_number: i32, emitted_index: u32, ) -> Result<String, ExpandError>
Expand the template for a 1-based page number.
emitted_index is the 1-based count of pages actually written so far
including this one — not the logical page number, which --pages 3
would make 3 for a job that emits a single file. A template without a
%d is only valid while that count is 1.
Trait Implementations§
Source§impl Clone for OutputTemplate
impl Clone for OutputTemplate
Source§fn clone(&self) -> OutputTemplate
fn clone(&self) -> OutputTemplate
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 OutputTemplate
impl Debug for OutputTemplate
impl Eq for OutputTemplate
Source§impl PartialEq for OutputTemplate
impl PartialEq for OutputTemplate
impl StructuralPartialEq for OutputTemplate
Auto Trait Implementations§
impl Freeze for OutputTemplate
impl RefUnwindSafe for OutputTemplate
impl Send for OutputTemplate
impl Sync for OutputTemplate
impl Unpin for OutputTemplate
impl UnsafeUnpin for OutputTemplate
impl UnwindSafe for OutputTemplate
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