pub struct LayoutReport {
pub measured: bool,
pub reason: Option<String>,
pub checked: usize,
pub findings: Vec<LayoutFinding>,
pub passes: bool,
}Expand description
The answer of the layout check: whether the halves were read, how many paths were judged, and every path a contract excludes. A report that could not read the halves never passes, so silence about a tree nobody measured cannot read as a clean tree.
use majordomus_cli::layout::LayoutReport;
let clean = LayoutReport::of(true, None, 12, Vec::new());
assert!(clean.passes);
assert_eq!(clean.checked, 12);
let unread = LayoutReport::of(false, Some("git could not start".into()), 0, Vec::new());
assert!(!unread.passes, "nothing found because nothing was read");
assert_eq!(unread.reason.as_deref(), Some("git could not start"));Fields§
§measured: boolWhether the halves could be read at all. false is not a pass.
reason: Option<String>Why they could not, when they could not.
checked: usizeHow many paths were judged.
findings: Vec<LayoutFinding>Every path a contract excludes, in canonical order. Empty is the passing answer.
passes: booltrue when the halves were read and nothing was found.
Implementations§
Source§impl LayoutReport
impl LayoutReport
Sourcepub fn of(
measured: bool,
reason: Option<String>,
checked: usize,
findings: Vec<LayoutFinding>,
) -> Self
pub fn of( measured: bool, reason: Option<String>, checked: usize, findings: Vec<LayoutFinding>, ) -> Self
A report, its verdict derived from what was measured and found. The findings are put in canonical order — by path, the contract breaking the tie — whatever order the walk found them in, so two runs over one tree answer the same bytes.
use majordomus_cli::layout::{LayoutFinding, LayoutReport};
let at = |path: &str| LayoutFinding {
path: path.into(),
contract: "manifest local".into(),
excludes: "canonical".into(),
reason: "a copy".into(),
};
let found = vec![at(".ai/local/z.md"), at(".ai/local/a.md")];
let report = LayoutReport::of(true, None, 5, found);
assert!(!report.passes, "measured, but something was found");
let paths: Vec<&str> = report.findings.iter().map(|f| f.path.as_str()).collect();
assert_eq!(paths, [".ai/local/a.md", ".ai/local/z.md"]);Trait Implementations§
Source§impl Clone for LayoutReport
impl Clone for LayoutReport
Source§fn clone(&self) -> LayoutReport
fn clone(&self) -> LayoutReport
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 LayoutReport
impl Debug for LayoutReport
Source§impl<'de> Deserialize<'de> for LayoutReport
impl<'de> Deserialize<'de> for LayoutReport
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for LayoutReport
Source§impl JsonSchema for LayoutReport
impl JsonSchema for LayoutReport
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 moreSource§impl PartialEq for LayoutReport
impl PartialEq for LayoutReport
Source§fn eq(&self, other: &LayoutReport) -> bool
fn eq(&self, other: &LayoutReport) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for LayoutReport
impl Serialize for LayoutReport
impl StructuralPartialEq for LayoutReport
Auto Trait Implementations§
impl Freeze for LayoutReport
impl RefUnwindSafe for LayoutReport
impl Send for LayoutReport
impl Sync for LayoutReport
impl Unpin for LayoutReport
impl UnsafeUnpin for LayoutReport
impl UnwindSafe for LayoutReport
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
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
Compare self to
key and return true if they are equal.