Struct debian_control::relations::Relation

source ·
pub struct Relation(/* private fields */);

Implementations§

source§

impl Relation

source

pub fn new( name: &str, version_constraint: Option<(VersionConstraint, Version)>, ) -> Self

source

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");
source

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");
source

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");
source

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()));
source

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");
source

pub fn version(&self) -> Option<(VersionConstraint, Version)>

Return the version constraint and the version it is constrained to.

source

pub fn architectures(&self) -> impl Iterator<Item = String> + '_

Return an iterator over the architectures for this relation

source

pub fn profiles(&self) -> impl Iterator<Item = Vec<BuildProfile>> + '_

Returns an iterator over the build profiles for this relation

Trait Implementations§

source§

impl Debug for Relation

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Relation

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<Relation> for Entry

source§

fn from(relation: Relation) -> Self

Converts to this type from the input type.
source§

impl FromStr for Relation

§

type Err = String

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl PartialEq for Relation

source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.