Struct pep440_rs::VersionPattern
source · pub struct VersionPattern { /* private fields */ }
Expand description
A version number pattern.
A version pattern appears in a
VersionSpecifier
. It is just like a version,
except that it permits a trailing *
(wildcard) at the end of the version
number. The wildcard indicates that any version with the same prefix should
match.
A VersionPattern
cannot do any matching itself. Instead,
it needs to be paired with an Operator
to create a
VersionSpecifier
.
Here are some valid and invalid examples:
1.2.3
-> verbatim pattern1.2.3.*
-> wildcard pattern1.2.*.4
-> invalid1.0-dev1.*
-> invalid
Implementations§
source§impl VersionPattern
impl VersionPattern
sourcepub fn verbatim(version: Version) -> VersionPattern
pub fn verbatim(version: Version) -> VersionPattern
Creates a new verbatim version pattern that matches the given version exactly.
sourcepub fn wildcard(version: Version) -> VersionPattern
pub fn wildcard(version: Version) -> VersionPattern
Creates a new wildcard version pattern that matches any version with the given version as a prefix.
sourcepub fn into_version(self) -> Version
pub fn into_version(self) -> Version
Consumes this pattern and returns ownership of the underlying version.
sourcepub fn is_wildcard(&self) -> bool
pub fn is_wildcard(&self) -> bool
Returns true if and only if this pattern contains a wildcard.
Trait Implementations§
source§impl Clone for VersionPattern
impl Clone for VersionPattern
source§fn clone(&self) -> VersionPattern
fn clone(&self) -> VersionPattern
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for VersionPattern
impl Debug for VersionPattern
source§impl FromStr for VersionPattern
impl FromStr for VersionPattern
§type Err = VersionPatternParseError
type Err = VersionPatternParseError
The associated error which can be returned from parsing.
source§fn from_str(version: &str) -> Result<VersionPattern, VersionPatternParseError>
fn from_str(version: &str) -> Result<VersionPattern, VersionPatternParseError>
Parses a string
s
to return a value of this type. Read moresource§impl Hash for VersionPattern
impl Hash for VersionPattern
source§impl PartialEq for VersionPattern
impl PartialEq for VersionPattern
source§fn eq(&self, other: &VersionPattern) -> bool
fn eq(&self, other: &VersionPattern) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for VersionPattern
impl StructuralPartialEq for VersionPattern
Auto Trait Implementations§
impl RefUnwindSafe for VersionPattern
impl Send for VersionPattern
impl Sync for VersionPattern
impl Unpin for VersionPattern
impl UnwindSafe for VersionPattern
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