pub struct SemVer {
pub major: u32,
pub minor: u32,
pub patch: u32,
}Expand description
The major.minor.patch version object, serialized as a nested mapping to
match r2modman’s VersionNumber.
Fields§
§major: u32The major component, or 0 if the source string had none.
minor: u32The minor component, or 0 if the source string had none.
patch: u32The patch component, or 0 if the source string had none. A prerelease
suffix is discarded, so 1.2.3-beta parses to a patch of 3.
Implementations§
Source§impl SemVer
impl SemVer
Sourcepub fn parse(s: &str) -> SemVer
pub fn parse(s: &str) -> SemVer
Parses the first three dot-separated integer components of s; a missing or
non-numeric component becomes 0 (so "1.2" -> 1.2.0, "1.2.3-beta" ->
1.2.3).
Never fails and never panics: an unparseable or overflowing component
degrades to 0 rather than rejecting a mods.yml r2modman itself accepts.
§Examples
use thunderstore_engine::profile::modlist::SemVer;
assert_eq!(SemVer::parse("1.2.3").to_string(), "1.2.3");
assert_eq!(SemVer::parse("1.2").to_string(), "1.2.0");
assert_eq!(SemVer::parse("1.2.3-beta").to_string(), "1.2.3");
assert_eq!(SemVer::parse("not-a-version").to_string(), "0.0.0");Trait Implementations§
impl Copy for SemVer
Source§impl<'de> Deserialize<'de> for SemVer
impl<'de> Deserialize<'de> for SemVer
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for SemVer
impl StructuralPartialEq for SemVer
Auto Trait Implementations§
impl Freeze for SemVer
impl RefUnwindSafe for SemVer
impl Send for SemVer
impl Sync for SemVer
impl Unpin for SemVer
impl UnsafeUnpin for SemVer
impl UnwindSafe for SemVer
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.