pub struct Version {
pub major: u64,
pub minor: u64,
pub patch: u64,
}Expand description
A semantic version, only as much as this needs.
Ordered by the three numbers, which is what lets the writer refuse a version smaller than the one the contract requires rather than only a bump smaller than required.
Fields§
§major: u64Major.
minor: u64Minor.
patch: u64Patch.
Implementations§
Source§impl Version
impl Version
Sourcepub fn raised(self, bump: Bump) -> Version
pub fn raised(self, bump: Bump) -> Version
This version raised by bump.
Arithmetic and nothing else: zero-major is not special-cased here, because whether a
breaking change below 1.0 costs a major or a minor is a policy question and this
repository answers it in exactly one place, crate::release::compat::Policy. A
second answer here is the shape this subsystem was built to remove.
Source§impl Version
impl Version
Sourcepub fn raised_to(self, impact: Impact) -> Version
pub fn raised_to(self, impact: Impact) -> Version
This version raised by a measured compatibility impact.
The bridge between the engine’s verdict and the arithmetic: the policy has already
decided what a 0.x breaking change costs, so this only has to apply it.
use majordomus_cli::release::compat::Impact;
use majordomus_cli::release::version::Version;
let v = Version::parse("0.5.0").unwrap();
assert_eq!(v.raised_to(Impact::Minor).to_string(), "0.6.0");
assert_eq!(v.raised_to(Impact::Major).to_string(), "1.0.0");
assert_eq!(v.raised_to(Impact::None).to_string(), "0.5.0");Trait Implementations§
impl Copy for Version
impl Eq for Version
Source§impl Ord for Version
impl Ord for Version
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Version
impl PartialOrd 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 UnsafeUnpin 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
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.