pub enum DecidedBy {
Contract,
ContractAndCommits,
Undecided,
}Expand description
Who answered a version report’s next: the public contract, the contract with the
commits — or no one, because the contract could not be measured.
ADR 0051 makes the contract the authority and demotes conventional commits to evidence,
so DecidedBy::Contract is the normal answer. An unmeasurable contract is refused, not
guessed: DecidedBy::Undecided leaves next absent and carries the reason, and the
commit inference stays what it always is, evidence — never the answer in its place.
use majordomus_cli::release::model::DecidedBy;
assert_eq!(serde_json::to_value(DecidedBy::Contract).unwrap(), "contract");
assert_eq!(DecidedBy::Undecided.as_str(), "undecided");
assert_eq!(DecidedBy::default(), DecidedBy::Undecided);Variants§
Contract
release analyze measured the public contract against the last release, and next
is the version it requires: the declared version when that already satisfies the
contract, otherwise the smallest one it allows.
ContractAndCommits
The contract was measured and requires no release over the last one — only behaviour
behind the public boundary changed — while the commits carry changes: next is the
smallest release above the last, a patch, however much the commit subjects claim.
Undecided
The contract could not be measured — no published baseline carries a registry, or a
version is not three numbers — so nothing decides next: it is absent, the reason is
in contract_unreadable, and release bump without an explicit target refuses.
Implementations§
Source§impl DecidedBy
impl DecidedBy
Sourcepub fn as_str(self) -> &'static str
pub fn as_str(self) -> &'static str
The word the JSON value carries for who answered.
use majordomus_cli::release::model::DecidedBy;
for by in [DecidedBy::Contract, DecidedBy::ContractAndCommits, DecidedBy::Undecided] {
assert_eq!(serde_json::to_value(by).unwrap(), by.as_str());
}Sourcepub fn phrase(self) -> &'static str
pub fn phrase(self) -> &'static str
Who answered, as the text renderings print it in parentheses after next.
use majordomus_cli::release::model::DecidedBy;
assert_eq!(DecidedBy::Contract.phrase(), "decided by the contract");
let both = DecidedBy::ContractAndCommits.phrase();
assert_eq!(both, "decided by the contract and the commits");
let none = DecidedBy::Undecided.phrase();
assert_eq!(none, "undecided: the contract could not be measured");Trait Implementations§
impl Copy for DecidedBy
Source§impl<'de> Deserialize<'de> for DecidedBy
impl<'de> Deserialize<'de> for DecidedBy
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>,
impl Eq for DecidedBy
Source§impl JsonSchema for DecidedBy
impl JsonSchema for DecidedBy
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreimpl StructuralPartialEq for DecidedBy
Auto Trait Implementations§
impl Freeze for DecidedBy
impl RefUnwindSafe for DecidedBy
impl Send for DecidedBy
impl Sync for DecidedBy
impl Unpin for DecidedBy
impl UnsafeUnpin for DecidedBy
impl UnwindSafe for DecidedBy
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<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§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.