| 1 | #![deny(missing_docs)] |
| 2 | #![doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/README.md"))] |
| 3 | |
| 4 | pub mod lossless; |
| 5 | pub mod lossy; |
| 6 | |
| 7 | mod relations; |
| 8 | pub use relations::{VersionConstraint, VersionLookup}; |
| 9 | |
| 10 | pub use lossy::RDescription; |
| 11 | |
| 12 | mod version; |
| 13 | pub 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. |
| 20 | pub struct RCode(String); |
| 21 | |
| 22 | impl 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 | |
| 30 | impl std::fmt::Display for RCode { |
| 31 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
| 32 | write!(f, "{}", self.0) |
| 33 | } |
| 34 | } |