pub enum PageSelection {
All,
Ranges(Vec<(u32, u32)>),
}Expand description
Canonical page selection. Page selection enters config_sha256: a different range is a
legitimately different canonical output.
Variants§
All
All pages (canonical form: the string "all").
Ranges(Vec<(u32, u32)>)
Merged, sorted, 1-based inclusive ranges (canonical form: [[lo, hi], …]).
Implementations§
Source§impl PageSelection
impl PageSelection
Sourcepub fn parse(input: &str) -> Result<Self, PageSelectionError>
pub fn parse(input: &str) -> Result<Self, PageSelectionError>
Parse --pages syntax: comma-separated 1-based pages or inclusive ranges,
e.g. 1-5,9. Overlapping/adjacent ranges merge; order normalizes ascending.
Syntax and out-of-range failures are PageSelectionError — usage errors the
CLI maps to exit code 2, deliberately distinct from the 10 stable parse-failure
codes (those describe the document, not the invocation).
Sourcepub fn validate_against(
&self,
page_count: u32,
) -> Result<(), PageSelectionError>
pub fn validate_against( &self, page_count: u32, ) -> Result<(), PageSelectionError>
Validate against the document’s page count: out-of-range selection is a stable
error (page_limit_exceeded is about limits; out-of-range selection is usage —
PRD §16 wants a stable error on out-of-range, mapped here to invalid usage error).
Sourcepub fn canonical_value(&self) -> Value
pub fn canonical_value(&self) -> Value
Canonical JSON form for the config hash (contract §7):
"all" or [[lo, hi], …].
Trait Implementations§
Source§impl Clone for PageSelection
impl Clone for PageSelection
Source§fn clone(&self) -> PageSelection
fn clone(&self) -> PageSelection
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PageSelection
impl Debug for PageSelection
Source§impl Default for PageSelection
impl Default for PageSelection
Source§fn default() -> PageSelection
fn default() -> PageSelection
impl Eq for PageSelection
Source§impl PartialEq for PageSelection
impl PartialEq for PageSelection
Source§fn eq(&self, other: &PageSelection) -> bool
fn eq(&self, other: &PageSelection) -> bool
self and other values to be equal, and is used by ==.