Skip to main content

names

Macro names 

Source
macro_rules! names {
    ($($(#[$meta:meta])* $konst:ident = $spelling:literal;)*) => { ... };
}
Expand description

Declare PDF name constants: one table, no desyncing spellings.

Each entry names a Rust constant and the exact bytes the specification spells the key with — a table that would otherwise be written twice, in the constants module and at every use site.

pdfrum_object::names! {
    /// The stream's declared byte length.
    LENGTH = "Length";
}
assert_eq!(LENGTH.as_str(), Some("Length"));