pub struct PdfVersion {
pub major: u8,
pub minor: u8,
}Expand description
The version digits from a %PDF-M.N header.
Two independent digits, not a packed integer. The packed form — 17 for
1.7 — survives only as a private conversion beside the header parser
(pdfrum-parser’s doc::read_version), and appears in no public
signature anywhere in the workspace.
Ordering is lexicographic on (major, minor), so PDF_1_4 < PDF_1_7 < PDF_2_0 — which is what “at least version X” means, and what a packed
comparison gets wrong the moment a major digit reaches two of its own
(PdfVersion::new(11, 0) orders above 1.9; 110 > 19 only by luck of the
digit count).
use pdfrum_common::PdfVersion;
assert_eq!(PdfVersion::PDF_1_7.to_string(), "1.7");
assert!(PdfVersion::PDF_1_4 < PdfVersion::PDF_2_0);
assert_eq!(PdfVersion::new(1, 5), PdfVersion::PDF_1_5);Fields§
§major: u8The digit before the dot.
minor: u8The digit after it.
Implementations§
Source§impl PdfVersion
impl PdfVersion
Trait Implementations§
Source§impl Clone for PdfVersion
impl Clone for PdfVersion
Source§fn clone(&self) -> PdfVersion
fn clone(&self) -> PdfVersion
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 moreimpl Copy for PdfVersion
Source§impl Debug for PdfVersion
impl Debug for PdfVersion
Source§impl Display for PdfVersion
impl Display for PdfVersion
impl Eq for PdfVersion
Source§impl Hash for PdfVersion
impl Hash for PdfVersion
Source§impl Ord for PdfVersion
impl Ord for PdfVersion
Source§fn cmp(&self, other: &PdfVersion) -> Ordering
fn cmp(&self, other: &PdfVersion) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for PdfVersion
impl PartialEq for PdfVersion
Source§impl PartialOrd for PdfVersion
impl PartialOrd for PdfVersion
impl StructuralPartialEq for PdfVersion
Auto Trait Implementations§
impl Freeze for PdfVersion
impl RefUnwindSafe for PdfVersion
impl Send for PdfVersion
impl Sync for PdfVersion
impl Unpin for PdfVersion
impl UnsafeUnpin for PdfVersion
impl UnwindSafe for PdfVersion
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