pub struct Entry(/* private fields */);
Expand description
A node in the syntax tree representing a $ast
Implementations§
Source§impl Entry
impl Entry
Sourcepub fn replace(&mut self, idx: usize, relation: Relation)
pub fn replace(&mut self, idx: usize, relation: Relation)
Replace the relation at the given index
Sourcepub fn wrap_and_sort(&self) -> Self
pub fn wrap_and_sort(&self) -> Self
Wrap and sort the relations in this entry
Sourcepub fn relations(&self) -> impl Iterator<Item = Relation> + '_
pub fn relations(&self) -> impl Iterator<Item = Relation> + '_
Iterate over the relations in this entry
Sourcepub fn iter(&self) -> impl Iterator<Item = Relation> + '_
pub fn iter(&self) -> impl Iterator<Item = Relation> + '_
Iterate over the relations in this entry
Sourcepub fn get_relation(&self, idx: usize) -> Option<Relation>
pub fn get_relation(&self, idx: usize) -> Option<Relation>
Get the relation at the given index
Sourcepub fn remove_relation(&self, idx: usize) -> Relation
pub fn remove_relation(&self, idx: usize) -> Relation
Remove the relation at the given index
§Arguments
idx
- The index of the relation to remove
§Example
use debian_control::lossless::relations::{Relation,Entry};
let mut entry: Entry = r"python3-dulwich (>= 0.19.0) | python3-requests".parse().unwrap();
entry.remove_relation(1);
assert_eq!(entry.to_string(), "python3-dulwich (>= 0.19.0)");
Sourcepub fn satisfied_by(&self, package_version: impl VersionLookup + Copy) -> bool
pub fn satisfied_by(&self, package_version: impl VersionLookup + Copy) -> bool
Check if this entry is satisfied by the given package versions.
§Arguments
package_version
- A function that returns the version of a package.
§Example
use debian_control::lossless::relations::{Relation,Entry};
let entry = Entry::from(vec!["samba (>= 2.0)".parse::<Relation>().unwrap()]);
assert!(entry.satisfied_by(|name: &str| -> Option<debversion::Version> {
match name {
"samba" => Some("2.0".parse().unwrap()),
_ => None
}}));
Sourcepub fn remove(&mut self)
pub fn remove(&mut self)
Remove this entry
§Example
use debian_control::lossless::relations::{Relations,Entry};
let mut relations: Relations = r"python3-dulwich (>= 0.19.0), python3-urllib3 (<< 1.26.0)".parse().unwrap();
let mut entry = relations.get_entry(0).unwrap();
entry.remove();
assert_eq!(relations.to_string(), "python3-urllib3 (<< 1.26.0)");
Sourcepub fn push(&mut self, relation: Relation)
pub fn push(&mut self, relation: Relation)
Push a new relation to the entry
§Arguments
relation
- The relation to push
§Example
use debian_control::lossless::relations::{Relation,Entry};
let mut entry: Entry = "samba (>= 2.0)".parse().unwrap();
entry.push("python3-requests".parse().unwrap());
assert_eq!(entry.to_string(), "samba (>= 2.0) | python3-requests");
Trait Implementations§
Source§impl Ord for Entry
impl Ord for Entry
Source§impl PartialOrd for Entry
impl PartialOrd for Entry
impl Eq for Entry
Auto Trait Implementations§
impl Freeze for Entry
impl !RefUnwindSafe for Entry
impl !Send for Entry
impl !Sync for Entry
impl Unpin for Entry
impl !UnwindSafe for Entry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more