pub struct ClaimEvidence {
pub proof: ClaimProof,
pub executions: Vec<Execution>,
pub also_proves: Vec<String>,
}Expand description
One claim with everything the repository can say about its proof, and the way back out to the test that carries it.
The proof is flattened in, so a client reads one claim rather than an evidence wrapper around one; the executions and the other claims the same test proves sit beside it.
use majordomus_cli::capability::builtin::evidence::ClaimEvidence;
use majordomus_cli::evidence::ClaimProof;
let proof: ClaimProof = serde_json::from_value(serde_json::json!({
"id": "evidence-both-directions",
"claim": "a claim and its test answer for each other",
"status": "guaranteed",
"source": null,
"implementation": null,
"test_path": "test/cases/84_distribution_model.sh",
"test": "suite:84_distribution_model",
"state": "not_run",
"meaning": "no run of this test has been recorded",
"execution": null,
"changed": [],
"reproduce": "bash test/run.sh 84_distribution_model"
}))
.unwrap();
let answer = ClaimEvidence {
proof,
executions: Vec::new(),
also_proves: vec!["evidence-record-is-not-networked".to_string()],
};
let json = serde_json::to_value(&answer).unwrap();
assert_eq!(json["id"], "evidence-both-directions");
assert!(json.get("proof").is_none(), "the claim is flattened in, not nested");
assert_eq!(json["also_proves"], serde_json::json!(["evidence-record-is-not-networked"]));
// a list even where the ledger keeps one: retention is a decision that may change,
// and a client that read a bare object would break when it did
assert_eq!(json["executions"], serde_json::json!([]));Fields§
§proof: ClaimProofThe claim, joined to its evidence.
executions: Vec<Execution>Every execution the ledger holds for this claim’s test — today one, the latest, and a list because the ledger’s retention is a decision that may change and a client that read a bare object would break when it did.
also_proves: Vec<String>The other claims the same test proves. A test shared by twelve claims is a test whose failure is twelve findings, and a reader of one of them should be able to see the other eleven without searching.
Trait Implementations§
Source§impl Clone for ClaimEvidence
impl Clone for ClaimEvidence
Source§fn clone(&self) -> ClaimEvidence
fn clone(&self) -> ClaimEvidence
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ClaimEvidence
impl Debug for ClaimEvidence
Source§impl JsonSchema for ClaimEvidence
impl JsonSchema for ClaimEvidence
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreAuto Trait Implementations§
impl Freeze for ClaimEvidence
impl RefUnwindSafe for ClaimEvidence
impl Send for ClaimEvidence
impl Sync for ClaimEvidence
impl Unpin for ClaimEvidence
impl UnsafeUnpin for ClaimEvidence
impl UnwindSafe for ClaimEvidence
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