Module relations

Module relations 

Source
Expand description

Parser for relationship fields like Depends, Recommends, etc.

§Example

use debian_control::lossless::relations::{Relations, Relation};
use debian_control::relations::VersionConstraint;

let mut relations: Relations = r"python3-dulwich (>= 0.19.0), python3-requests, python3-urllib3 (<< 1.26.0)".parse().unwrap();
assert_eq!(relations.to_string(), "python3-dulwich (>= 0.19.0), python3-requests, python3-urllib3 (<< 1.26.0)");
assert!(relations.satisfied_by(|name: &str| -> Option<debversion::Version> {
   match name {
   "python3-dulwich" => Some("0.19.0".parse().unwrap()),
   "python3-requests" => Some("2.25.1".parse().unwrap()),
   "python3-urllib3" => Some("1.25.11".parse().unwrap()),
   _ => None
   }}));
relations.remove_entry(1);
relations.get_entry(0).unwrap().get_relation(0).unwrap().set_archqual("amd64");
assert_eq!(relations.to_string(), "python3-dulwich:amd64 (>= 0.19.0), python3-urllib3 (<< 1.26.0)");

Structs§

DefaultSortingOrder
Default sorting order (lexicographical with special items last).
Entry
A node in the syntax tree representing a $ast
ParseError
Error type for parsing relations fields
Relation
A node in the syntax tree representing a $ast
RelationBuilder
A builder for creating a Relation
Relations
A node in the syntax tree representing a $ast
Substvar
A node in the syntax tree representing a $ast
WrapAndSortOrder
Sorting order matching wrap-and-sort behavior.

Traits§

SortingOrder
Trait for defining sorting order of package relations.