pub struct SemVer { /* private fields */ }Expand description
A strict major.minor.patch semantic version with ordering support.
Pre-release (-beta.1) and build (+sha) suffixes are ignored for
comparison, matching how runtime tools report stable versions.
Implementations§
Source§impl SemVer
impl SemVer
Sourcepub fn parse(raw: &str) -> Option<SemVer>
pub fn parse(raw: &str) -> Option<SemVer>
Parses "v18.12.0", "18.12.0", "18.2", or "18" (missing parts
default to 0). Returns None for non-version strings.
use limitless_cli::modules::runtime_validator::SemVer;
assert!(SemVer::parse("v18.12.0").is_some());
assert!(SemVer::parse("18").is_some());
assert!(SemVer::parse("lts").is_none());
assert!(SemVer::parse("18.12.0").unwrap() > SemVer::parse("18.2.0").unwrap());
assert!(SemVer::parse("1.85.0").unwrap() > SemVer::parse("1.56.0").unwrap());Trait Implementations§
impl Copy for SemVer
impl Eq for SemVer
Source§impl Ord for SemVer
impl Ord for SemVer
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for SemVer
impl PartialOrd for SemVer
impl StructuralPartialEq for SemVer
Auto Trait Implementations§
impl Forget for SemVer
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