pub struct Relation {
pub name: String,
pub version: Option<(VersionConstraint, Version)>,
}
Expand description
A relation entry in a relationship field.
Fields§
§name: String
Package name.
version: Option<(VersionConstraint, Version)>
Version constraint and version.
Implementations§
Source§impl Relation
impl Relation
Sourcepub fn satisfied_by(&self, package_version: impl VersionLookup) -> bool
pub fn satisfied_by(&self, package_version: impl VersionLookup) -> 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 r_description::lossy::Relation;
use r_description::Version;
let entry: Relation = "cli (>= 2.0)".parse().unwrap();
assert!(entry.satisfied_by(|name: &str| -> Option<Version> {
match name {
"cli" => Some("2.0".parse().unwrap()),
_ => None
}}));
Trait Implementations§
Source§impl FromIterator<Relation> for Relations
impl FromIterator<Relation> for Relations
impl Eq for Relation
impl StructuralPartialEq for Relation
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