Struct VersionReq
struct VersionReq { ... }
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
Comparatoris an operator (Op) and a partial version, separated by optional whitespace. For example>=1.0.0or>=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: crate::alloc::vec::Vec<Comparator>
Implementations
impl VersionReq
fn parse(text: &str) -> Result<Self, Error>Create
VersionReqby 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.
-
fn matches(self: &Self, version: &Version) -> boolEvaluate whether the given
Versionsatisfies the version requirement described byself.
impl Clone for VersionReq
fn clone(self: &Self) -> VersionReq
impl Debug for VersionReq
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result
impl Default for VersionReq
fn default() -> Self
impl Display for crate::VersionReq
fn fmt(self: &Self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result
impl Eq for VersionReq
impl Freeze for VersionReq
impl FromIterator for crate::VersionReq
fn from_iter<I>(iter: I) -> Self where I: IntoIterator<Item = Comparator>
impl FromStr for crate::VersionReq
fn from_str(text: &str) -> Result<Self, <Self as >::Err>
impl Hash for VersionReq
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)
impl PartialEq for VersionReq
fn eq(self: &Self, other: &VersionReq) -> bool
impl RefUnwindSafe for VersionReq
impl Send for VersionReq
impl Serialize for crate::VersionReq
fn serialize<S>(self: &Self, serializer: S) -> Result<<S as >::Ok, <S as >::Error> where S: Serializer
impl StructuralPartialEq for VersionReq
impl Sync for VersionReq
impl Unpin for VersionReq
impl UnwindSafe for VersionReq
impl<'de> Deserialize for crate::VersionReq
fn deserialize<D>(deserializer: D) -> Result<Self, <D as >::Error> where D: Deserializer<'de>
impl<T> Any for VersionReq
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for VersionReq
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for VersionReq
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for VersionReq
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> DeserializeOwned for VersionReq
impl<T> From for VersionReq
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for VersionReq
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T> ToString for VersionReq
fn to_string(self: &Self) -> String
impl<T, U> Into for VersionReq
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for VersionReq
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for VersionReq
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>