Struct semver::VersionReq [−][src]
pub struct VersionReq { pub comparators: Vec<Comparator>, }
Expand description
SemVer version requirement describing the intersection of some version
comparators, such as >=1.2.3, <1.8
.
Syntax
-
Either
*
(meaning “any”), or one or more comma-separated comparators. -
A
Comparator
is an operator (Op
) and a partial version, separated by optional whitespace. For example>=1.0.0
or>=1.0
. -
Build metadata is syntactically permitted on the partial versions, but is completely ignored, as it’s never relevant to whether any comparator matches a particular version.
-
Whitespace is permitted around commas and around operators. Whitespace is not permitted within a partial version, i.e. anywhere between the major version number and its minor, patch, pre-release, or build metadata.
Fields
comparators: Vec<Comparator>
Implementations
impl VersionReq
[src]
impl VersionReq
[src]pub const STAR: Self
[src]
pub const STAR: Self
[src]A VersionReq
with no constraint on the version numbers it matches.
Equivalent to VersionReq::parse("*").unwrap()
.
In terms of comparators this is equivalent to >=0.0.0
.
Counterintuitively a *
VersionReq does not match every possible
version number. In particular, in order for any VersionReq
to match
a pre-release version, the VersionReq
must contain at least one
Comparator
that has an explicit major, minor, and patch version
identical to the pre-release being matched, and that has a nonempty
pre-release component. Since *
is not written with an explicit major,
minor, and patch version, and does not contain a nonempty pre-release
component, it does not match any pre-release versions.
pub fn parse(text: &str) -> Result<Self, Error>
[src]
pub fn parse(text: &str) -> Result<Self, Error>
[src]Create VersionReq
by parsing from string representation.
Errors
Possible reasons for the parse to fail include:
-
>a.b
— unexpected characters in the partial version. -
@1.0.0
— unrecognized comparison operator. -
^1.0.0,
— unexpected end of input. -
>=1.0 <2.0
— missing comma between comparators. -
*.*
— unsupported wildcard syntax.
Trait Implementations
impl Clone for VersionReq
[src]
impl Clone for VersionReq
[src]fn clone(&self) -> VersionReq
[src]
fn clone(&self) -> VersionReq
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl Debug for VersionReq
[src]
impl Debug for VersionReq
[src]impl Default for VersionReq
[src]
impl Default for VersionReq
[src]fn default() -> VersionReq
[src]
fn default() -> VersionReq
[src]Returns the “default value” for a type. Read more
impl Display for VersionReq
[src]
impl Display for VersionReq
[src]impl FromStr for VersionReq
[src]
impl FromStr for VersionReq
[src]impl Hash for VersionReq
[src]
impl Hash for VersionReq
[src]impl PartialEq<VersionReq> for VersionReq
[src]
impl PartialEq<VersionReq> for VersionReq
[src]fn eq(&self, other: &VersionReq) -> bool
[src]
fn eq(&self, other: &VersionReq) -> bool
[src]This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &VersionReq) -> bool
[src]
fn ne(&self, other: &VersionReq) -> bool
[src]This method tests for !=
.
impl Eq for VersionReq
[src]
impl StructuralEq for VersionReq
[src]
impl StructuralPartialEq for VersionReq
[src]
Auto Trait Implementations
impl RefUnwindSafe for VersionReq
impl Send for VersionReq
impl Sync for VersionReq
impl Unpin for VersionReq
impl UnwindSafe for VersionReq
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more