pub struct Version<T: AsRef<str> = String> {
pub version: T,
pub flags: VersionFlags,
}Expand description
Version string with flags.
A type which holds version string along with associated VersionFlags,
allowing comparison and ordering.
assert!(Version::new("1.0") < Version::new("1.1"));
assert!(Version::new("1.1") == Version::new("1.0001"));
assert!(Version::new("1.0") < Version::new("1.1".to_string()));
assert!(Version::new("1.1") == Version::new("1.0001".to_string()));
assert!(Version::new("1.0".to_string()) < Version::new("1.1".to_string()));
assert!(Version::new("1.1".to_string()) == Version::new("1.0001".to_string()));Fields§
§version: TVersion string.
flags: VersionFlagsAssociated flags to tweak version comparison.
Implementations§
Source§impl<T: AsRef<str>> Version<T>
impl<T: AsRef<str>> Version<T>
Sourcepub fn with_flags(version: T, flags: VersionFlags) -> Self
pub fn with_flags(version: T, flags: VersionFlags) -> Self
Create version from string and flags.
Trait Implementations§
Source§impl<T: AsRef<str>> Ord for Version<T>
impl<T: AsRef<str>> Ord for Version<T>
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
Source§impl<T, U> PartialEq<Version<U>> for Version<T>
impl<T, U> PartialEq<Version<U>> for Version<T>
Source§impl<T, U> PartialOrd<Version<U>> for Version<T>
impl<T, U> PartialOrd<Version<U>> for Version<T>
impl<T: AsRef<str>> Eq for Version<T>
Auto Trait Implementations§
impl<T> Freeze for Version<T>where
T: Freeze,
impl<T> RefUnwindSafe for Version<T>where
T: RefUnwindSafe,
impl<T> Send for Version<T>where
T: Send,
impl<T> Sync for Version<T>where
T: Sync,
impl<T> Unpin for Version<T>where
T: Unpin,
impl<T> UnsafeUnpin for Version<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Version<T>where
T: UnwindSafe,
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