Debian Codegraph @

/

debian rust-r-description 0.4.1-1debian librust-r-description-dev debian librust-r-description+default-dev debian librust-r-description+serde-dev debian librust-r-description-0-dev debian librust-r-description-0+default-dev debian librust-r-description-0+serde-dev debian librust-r-description-0.4-dev debian librust-r-description-0.4+default-dev debian librust-r-description-0.4+serde-dev debian librust-r-description-0.4.1-dev debian librust-r-description-0.4.1+default-dev debian librust-r-description-0.4.1+serde-dev cargo r-description 0.4.1 debianjsonmakefilemarkdownrustrust-c-abishelltomlyaml 26 files · 831 symbols
View dependency graph

Depends on

  • dh-cargo (dh-sequence-cargo)
  • rust-deb822-derive (librust-deb822-derive-0.3+default-dev)
  • rust-deb822-fast (librust-deb822-fast-0.2+default-dev, librust-deb822-fast-0.2+derive-dev)
  • rust-deb822-lossless (librust-deb822-lossless+default-dev)
  • rust-rowan (librust-rowan-0.16+default-dev)
  • cargo, debhelper-compat, librust-serde-1+default-dev, librust-url-2+default-dev, libstd-rust-dev, rustc
README (full)

R DESCRIPTION parser

This crate provides a parser and editor for the DESCRIPTION files used in R packages.

See https://r-pkgs.org/description.html and https://cran.r-project.org/doc/manuals/R-exts.html for more information on the format.

Besides parsing the control files it also supports parsing and comparison of version strings according to the R package versioning scheme as well as relations between versions.

Example


use std::str::FromStr;
use r_description::lossy::RDescription;

let mut desc = RDescription::from_str(r###"Package: foo
Version: 1.0
Depends: R (>= 3.0.0)
Description: A foo package
Title: A foo package
License: GPL-3
"###).unwrap();

assert_eq!(desc.name, "foo");
assert_eq!(desc.version, "1.0".parse().unwrap());
assert_eq!(desc.depends, Some("R (>= 3.0.0)".parse().unwrap()));

desc.license = "MIT".to_string();
use r_description::Version;

// '-' and '.' are equivalent separators in R version strings
let v1: Version = "2.5-1".parse().unwrap();
let v2: Version = "2.5.1".parse().unwrap();
assert_eq!(v1, v2);

// Version strings can have more than three components
let v1: Version = "1.2.3.9000".parse().unwrap();
let v2: Version = "1.2.3".parse().unwrap();
assert!(v1 > v2);

use std::str::FromStr;
use r_description::lossy::Relations;

let v1 = r_description::Version::from_str("1.2.3").unwrap();
let rels: Relations = "cli (>= 2.0), crayon (== 1.3.4), testthat".parse().unwrap();
assert_eq!(3, rels.len());
assert_eq!(rels[0].name, "cli");
dir .github/
dir debian/
dir src/
dir testdata/
file .cargo_vcs_info.json
file .codespellrc
file .gitignore
file CODE_OF_CONDUCT.md
file Cargo.lock
file Cargo.toml
file Cargo.toml.orig
file README.md
file disperse.toml