pub struct Version { /* private fields */ }
Expand description
A struct representing a semantic version.
This struct contains three components of a version: major, minor, and patch. It derives common traits for easy comparison and manipulation.
§Examples
Creating a new version:
use app_version::Version;
let version = Version::new(1,0,0);
assert_eq!(version.major(), 1);
assert_eq!(version.minor(), 0);
assert_eq!(version.patch(), 0);
§Comparison
Versions can be compared for equality:
use app_version::Version;
let version1 = Version::new(1,0,0);
let version2 = Version::new(1,0,1);
assert_ne!(version1, version2);
Implementations§
Source§impl Version
impl Version
Sourcepub fn increment_patch(&mut self)
pub fn increment_patch(&mut self)
Increments the patch version.
Sourcepub fn increment_minor(&mut self)
pub fn increment_minor(&mut self)
Increments the minor version and resets patch to 0.
Sourcepub fn increment_major(&mut self)
pub fn increment_major(&mut self)
Increments the major version and resets minor and patch to 0.
Trait Implementations§
impl Copy for Version
impl Eq for Version
impl StructuralPartialEq for Version
Auto Trait Implementations§
impl Freeze for Version
impl RefUnwindSafe for Version
impl Send for Version
impl Sync for Version
impl Unpin for Version
impl UnwindSafe for Version
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