pub struct Relation { /* private fields */ }Expand description
A case-sensitive package name and optional version requirement.
Ordering compares package names case-insensitively, then uses their exact spelling and version requirement as deterministic tie-breakers.
Implementations§
Source§impl Relation
impl Relation
Sourcepub fn new(
package: impl Into<String>,
requirement: VersionRequirement,
) -> Result<Relation, InvalidRelationPackage>
pub fn new( package: impl Into<String>, requirement: VersionRequirement, ) -> Result<Relation, InvalidRelationPackage>
Constructs a relation after checking list-syntax ambiguity.
§Errors
Returns InvalidRelationPackage when the name is empty or contains
whitespace, control characters, commas, or parentheses.
Sourcepub fn any(
package: impl Into<String>,
) -> Result<Relation, InvalidRelationPackage>
pub fn any( package: impl Into<String>, ) -> Result<Relation, InvalidRelationPackage>
Constructs an unconstrained relation.
§Errors
Returns InvalidRelationPackage when the name cannot be represented
unambiguously in relation list syntax.
Sourcepub const fn requirement(&self) -> &VersionRequirement
pub const fn requirement(&self) -> &VersionRequirement
Returns the version requirement.
Trait Implementations§
impl Eq for Relation
Source§impl Ord for Relation
impl Ord for Relation
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Relation
impl PartialOrd 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 UnsafeUnpin 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