#description #parser #format #version #information #html #file

r-description

Rust library for parsing and generating R DESCRIPTION files

2 releases

new 0.1.1 Sep 9, 2024
0.1.0 Aug 28, 2024

#1612 in Parser implementations

Download history 416/week @ 2024-08-25 1071/week @ 2024-09-01

1,487 downloads per month

Apache-2.0

71KB
2K SLoC

R DESCRIPTION parser

This crate provides a parser and editor for the DESCRIPTION files used in R packages. Since the format is based on Debian control files, the parser uses the deb822_lossless crate for the lower layer parsing.

See https://r-pkgs.org/description.html for more information on the format.

Example


use r_description::RDescription;

let desc = r_description::parse(r###"Package: foo
Version: 1.0
# Inline comment that will be preserved.
Depends: R (>= 3.0.0)
"###).unwrap();

assert_eq!(desc.get("Package"), Some("foo"));
assert_eq!(desc.get("Version"), Some("1.0"));
assert_eq!(desc.get("Depends"), Some("R (>= 3.0.0"));

desc.insert("License", "MIT");

Dependencies

~4–6MB
~136K SLoC