pub enum UnresolvedVersionSpec {
Canary,
Alias(CompactString),
Req(VersionReq),
ReqAny(Vec<VersionReq>),
Calendar(CalVer),
Semantic(SemVer),
}
Expand description
Represents an unresolved version or alias that must be resolved to a fully-qualified version.
Variants§
Canary
A special canary target.
Alias(CompactString)
An alias that is used as a map to a version.
Req(VersionReq)
A partial version, requirement, or range (^
, ~
, etc).
ReqAny(Vec<VersionReq>)
A list of requirements to match any against (joined by ||
).
Calendar(CalVer)
A fully-qualified calendar version.
Semantic(SemVer)
A fully-qualified semantic version.
Implementations§
Source§impl UnresolvedVersionSpec
impl UnresolvedVersionSpec
Sourcepub fn parse<T: AsRef<str>>(value: T) -> Result<Self, SpecError>
pub fn parse<T: AsRef<str>>(value: T) -> Result<Self, SpecError>
Parse the provided string into an unresolved specification based on the following rules, in order:
- If the value “canary”, map as
Canary
variant. - If an alpha-numeric value that starts with a character, map as
Alias
. - If contains
||
, split and parse each item withVersionReq
, and map asReqAny
. - If contains
,
orVersionReq
, and map asReq
. - If starts with
=
,^
,~
,>
,<
, or*
, parse withVersionReq
, and map asReq
. - Else parse as
Semantic
orCalendar
types.
Sourcepub fn is_alias<A: AsRef<str>>(&self, name: A) -> bool
pub fn is_alias<A: AsRef<str>>(&self, name: A) -> bool
Return true if the provided alias matches the current specification.
Sourcepub fn is_latest(&self) -> bool
pub fn is_latest(&self) -> bool
Return true if the current specification is the “latest” alias.
Sourcepub fn to_resolved_spec(&self) -> VersionSpec
pub fn to_resolved_spec(&self) -> VersionSpec
Convert the current unresolved specification to a resolved specification.
Note that this does not actually resolve or validate against a manifest,
and instead simply constructs the VersionSpec
.
Furthermore, the Req
and ReqAny
variants will return a “latest” alias,
as they are not resolved or valid versions.
Trait Implementations§
Source§impl AsRef<UnresolvedVersionSpec> for UnresolvedVersionSpec
impl AsRef<UnresolvedVersionSpec> for UnresolvedVersionSpec
Source§fn as_ref(&self) -> &UnresolvedVersionSpec
fn as_ref(&self) -> &UnresolvedVersionSpec
Source§impl Clone for UnresolvedVersionSpec
impl Clone for UnresolvedVersionSpec
Source§fn clone(&self) -> UnresolvedVersionSpec
fn clone(&self) -> UnresolvedVersionSpec
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for UnresolvedVersionSpec
impl Debug for UnresolvedVersionSpec
Source§impl<'de> Deserialize<'de> for UnresolvedVersionSpec
impl<'de> Deserialize<'de> for UnresolvedVersionSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for UnresolvedVersionSpec
impl Display for UnresolvedVersionSpec
Source§impl FromStr for UnresolvedVersionSpec
impl FromStr for UnresolvedVersionSpec
Source§impl Hash for UnresolvedVersionSpec
impl Hash for UnresolvedVersionSpec
Source§impl Into<String> for UnresolvedVersionSpec
impl Into<String> for UnresolvedVersionSpec
Source§impl PartialEq<VersionSpec> for UnresolvedVersionSpec
impl PartialEq<VersionSpec> for UnresolvedVersionSpec
Source§impl PartialEq for UnresolvedVersionSpec
impl PartialEq for UnresolvedVersionSpec
Source§impl Serialize for UnresolvedVersionSpec
impl Serialize for UnresolvedVersionSpec
Source§impl TryFrom<String> for UnresolvedVersionSpec
impl TryFrom<String> for UnresolvedVersionSpec
impl Eq for UnresolvedVersionSpec
impl StructuralPartialEq for UnresolvedVersionSpec
Auto Trait Implementations§
impl Freeze for UnresolvedVersionSpec
impl RefUnwindSafe for UnresolvedVersionSpec
impl Send for UnresolvedVersionSpec
impl Sync for UnresolvedVersionSpec
impl Unpin for UnresolvedVersionSpec
impl UnwindSafe for UnresolvedVersionSpec
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string()
Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString
. Read more