From 5b0a85a5b9e3664c98d068e8f9268a4788fba33c Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Wed, 5 May 2021 19:18:22 +0200 Subject: Move PDF appearance key to a named constant Explain what the string means. --- src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 6bd4e70..e3e9101 100644 --- a/src/main.rs +++ b/src/main.rs @@ -26,6 +26,9 @@ use std::env; use std::process; +const PDF_TEXT_FIELD_DEFAULT_APPEARANCE_KEY: &'static str = "DA"; + + fn main() { match run() { Ok(_) => (), @@ -92,7 +95,7 @@ fn run () -> Result<(), anyhow::Error> { let key = std::str::from_utf8(k) .context("unable to convert PDF object key to UTF-8")?; - if key == "DA" { + if key == PDF_TEXT_FIELD_DEFAULT_APPEARANCE_KEY { let properties = v.as_str_mut() .context("unable to get properties of form field")?; -- cgit v1.2.3