21 releases

0.3.0 Nov 23, 2025
0.2.20 Dec 9, 2025
0.2.15 Nov 28, 2025
0.2.8 Nov 13, 2024
0.1.0 Jun 3, 2023

#351 in Cryptography

Download history 303/week @ 2025-09-25 278/week @ 2025-10-02 263/week @ 2025-10-09 285/week @ 2025-10-16 464/week @ 2025-10-23 411/week @ 2025-10-30 380/week @ 2025-11-06 247/week @ 2025-11-13 460/week @ 2025-11-20 247/week @ 2025-11-27 284/week @ 2025-12-04 300/week @ 2025-12-11 249/week @ 2025-12-18 153/week @ 2025-12-25 214/week @ 2026-01-01 394/week @ 2026-01-08

1,041 downloads per month
Used in upstream-ontologist

Apache-2.0 and maybe LGPL-2.0-or-later

195KB
4K SLoC

Format-preserving parser and editor for Debian watch files

This crate supports reading, editing and writing Debian watch files, while preserving the original contents byte-for-byte.

Example:

let wf = debian_watch::WatchFile::new(None);
assert_eq!(wf.version(), debian_watch::DEFAULT_VERSION);
assert_eq!("", wf.to_string());

let wf = debian_watch::WatchFile::new(Some(4));
assert_eq!(wf.version(), 4);
assert_eq!("version=4\n", wf.to_string());

let wf: debian_watch::WatchFile = r#"version=4
opts=foo=blah https://foo.com/bar .*/v?(\d\S+)\.tar\.gz
"#.parse().unwrap();

assert_eq!(wf.version(), 4);
assert_eq!(wf.entries().collect::<Vec<_>>().len(), 1);

let entry = wf.entries().next().unwrap();
assert_eq!(entry.opts(), maplit::hashmap! {
   "foo".to_string() => "blah".to_string(),
});
assert_eq!(&entry.url(), "https://foo.com/bar");
assert_eq!(entry.matching_pattern().as_deref(), Some(".*/v?(\\d\\S+)\\.tar\\.gz"));

It also supports partial parsing (with some error nodes), which could be useful for e.g. IDEs.

Dependencies

~7–26MB
~310K SLoC