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) -> Self
pub fn verbatim(version: Version) -> Self
Creates a new verbatim version pattern that matches the given version exactly.
Sourcepub fn wildcard(version: Version) -> Self
pub fn wildcard(version: Version) -> Self
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.
Trait Implementations§
Source§impl Clone for VersionPattern
impl Clone for VersionPattern
Source§fn clone(&self) -> VersionPattern
fn clone(&self) -> VersionPattern
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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
Source§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
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 Freeze for VersionPattern
impl RefUnwindSafe for VersionPattern
impl Send for VersionPattern
impl Sync for VersionPattern
impl Unpin for VersionPattern
impl UnsafeUnpin 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