pub enum ServedVerdict {
Served,
Stale,
Unreachable,
Malformed,
Dirty,
Undecided,
}Expand description
What an observation says about the expected commit. Only ServedVerdict::Served is a
proof; the other five are each a different reason the question was not answered yes.
use majordomus_cli::served::ServedVerdict;
// a measured no and an unanswered question are never spelled the same
assert!(ServedVerdict::Served.passes());
assert_eq!(ServedVerdict::Stale.exit_code(), 10);
assert_eq!(ServedVerdict::Unreachable.exit_code(), 12);Variants§
Served
The served build is the expected commit or contains it. The only passing verdict.
Stale
The served build does not contain the expected commit: the deployment is behind.
Unreachable
Nothing was received. The deployment was not measured.
Malformed
Something was received and it is not a build identity.
Dirty
The served build was made from an uncommitted tree, so it proves no commit.
Undecided
The served commit is not in this clone, or git could not be asked; containment is undecided. Fetching the remote usually turns this into an answer.
Implementations§
Source§impl ServedVerdict
impl ServedVerdict
Sourcepub fn as_str(self) -> &'static str
pub fn as_str(self) -> &'static str
The word every surface prints — the command line, the HTTP body and the MCP result all render the verdict through this one spelling.
use majordomus_cli::served::ServedVerdict;
assert_eq!(ServedVerdict::Undecided.as_str(), "undecided");
assert_eq!(ServedVerdict::Dirty.as_str(), "dirty");Sourcepub fn passes(self) -> bool
pub fn passes(self) -> bool
Whether this verdict proves the expected commit is deployed.
use majordomus_cli::served::ServedVerdict;
assert!(ServedVerdict::Served.passes());
// a site nobody could reach is not a site that serves the commit
assert!(!ServedVerdict::Unreachable.passes());
assert!(!ServedVerdict::Dirty.passes());Sourcepub fn exit_code(self) -> i32
pub fn exit_code(self) -> i32
The exit status the command line reports it with: 0 a proof, 10 a measured “no”,
12 a question that could not be answered. The same three codes scripts/pages verify uses, so a caller of either reads one convention.
use majordomus_cli::served::ServedVerdict;
assert_eq!(ServedVerdict::Served.exit_code(), 0);
assert_eq!(ServedVerdict::Dirty.exit_code(), 10); // measured, and a no
assert_eq!(ServedVerdict::Malformed.exit_code(), 12); // not measured at allTrait Implementations§
Source§impl Clone for ServedVerdict
impl Clone for ServedVerdict
Source§fn clone(&self) -> ServedVerdict
fn clone(&self) -> ServedVerdict
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ServedVerdict
Source§impl Debug for ServedVerdict
impl Debug for ServedVerdict
Source§impl<'de> Deserialize<'de> for ServedVerdict
impl<'de> Deserialize<'de> for ServedVerdict
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 ServedVerdict
Source§impl JsonSchema for ServedVerdict
impl JsonSchema for ServedVerdict
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 moreSource§impl PartialEq for ServedVerdict
impl PartialEq for ServedVerdict
Source§fn eq(&self, other: &ServedVerdict) -> bool
fn eq(&self, other: &ServedVerdict) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for ServedVerdict
impl Serialize for ServedVerdict
impl StructuralPartialEq for ServedVerdict
Auto Trait Implementations§
impl Freeze for ServedVerdict
impl RefUnwindSafe for ServedVerdict
impl Send for ServedVerdict
impl Sync for ServedVerdict
impl Unpin for ServedVerdict
impl UnsafeUnpin for ServedVerdict
impl UnwindSafe for ServedVerdict
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.