r_description/
lib.rs

1#![deny(missing_docs)]
2#![doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/README.md"))]
3
4pub mod lossless;
5pub mod lossy;
6
7mod relations;
8pub use relations::{VersionConstraint, VersionLookup};
9
10pub use lossy::RDescription;
11
12mod version;
13pub use version::Version;
14
15#[derive(Debug, PartialEq, Eq)]
16/// A block of R code
17///
18/// This is a simple wrapper around a string that represents a block of R code, as used in e.g. the
19/// Authors@R field.
20pub struct RCode(String);
21
22impl std::str::FromStr for RCode {
23    type Err = std::num::ParseIntError;
24
25    fn from_str(s: &str) -> Result<Self, Self::Err> {
26        Ok(Self(s.to_string()))
27    }
28}
29
30impl std::fmt::Display for RCode {
31    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
32        write!(f, "{}", self.0)
33    }
34}