Module relations

Module relations 

Source
Expand description

Parser for relationship fields like Depends, Recommends, etc.

§Example

use r_description::lossless::{Relations, Relation};
use r_description::VersionConstraint;

let mut relations: Relations = r"cli (>= 0.19.0), R".parse().unwrap();
assert_eq!(relations.to_string(), "cli (>= 0.19.0), R");
assert!(relations.satisfied_by(|name: &str| -> Option<r_description::Version> {
   match name {
   "cli" => Some("0.19.0".parse().unwrap()),
   "R" => Some("2.25.1".parse().unwrap()),
   _ => None
   }}));
relations.remove_relation(1);
assert_eq!(relations.to_string(), "cli (>= 0.19.0)");

Structs§

ParseError
Error type for parsing relations fields
Relation
A node in the syntax tree representing a $ast
Relations
A node in the syntax tree representing a $ast