Struct debian_control::relations::Relation
source · pub struct Relation(/* private fields */);
Implementations§
source§impl Relation
impl Relation
pub fn new( name: &str, version_constraint: Option<(VersionConstraint, Version)>, ) -> Self
sourcepub fn simple(name: &str) -> Self
pub fn simple(name: &str) -> Self
Create a new simple relation, without any version constraints.
§Example
use debian_control::relations::Relation;
let relation = Relation::simple("samba");
assert_eq!(relation.to_string(), "samba");
sourcepub fn drop_constraint(&mut self) -> bool
pub fn drop_constraint(&mut self) -> bool
Remove the version constraint from the relation.
§Example
use debian_control::relations::{Relation, VersionConstraint};
let mut relation = Relation::new("samba", Some((VersionConstraint::GreaterThanEqual, "2.0".parse().unwrap())));
relation.drop_constraint();
assert_eq!(relation.to_string(), "samba");
sourcepub fn name(&self) -> String
pub fn name(&self) -> String
Return the name of the package in the relation.
§Example
use debian_control::relations::Relation;
let relation = Relation::simple("samba");
assert_eq!(relation.name(), "samba");
sourcepub fn archqual(&self) -> Option<String>
pub fn archqual(&self) -> Option<String>
Return the archqual
§Example
use debian_control::relations::Relation;
let relation: Relation = "samba:any".parse().unwrap();
assert_eq!(relation.archqual(), Some("any".to_string()));
sourcepub fn set_archqual(&mut self, archqual: &str)
pub fn set_archqual(&mut self, archqual: &str)
Set the architecture qualifier for this relation.
§Example
use debian_control::relations::Relation;
let mut relation = Relation::simple("samba");
relation.set_archqual("any");
assert_eq!(relation.to_string(), "samba:any");
sourcepub fn version(&self) -> Option<(VersionConstraint, Version)>
pub fn version(&self) -> Option<(VersionConstraint, Version)>
Return the version constraint and the version it is constrained to.
sourcepub fn architectures(&self) -> impl Iterator<Item = String> + '_
pub fn architectures(&self) -> impl Iterator<Item = String> + '_
Return an iterator over the architectures for this relation
sourcepub fn profiles(&self) -> impl Iterator<Item = Vec<BuildProfile>> + '_
pub fn profiles(&self) -> impl Iterator<Item = Vec<BuildProfile>> + '_
Returns an iterator over the build profiles for this relation
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Relation
impl !RefUnwindSafe for Relation
impl !Send for Relation
impl !Sync for Relation
impl Unpin for Relation
impl !UnwindSafe for Relation
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