Skip to main content

RecordRequest

Struct RecordRequest 

Source
pub struct RecordRequest {
    pub suite: Option<PathBuf>,
    pub crate_output: Option<PathBuf>,
    pub origin: Origin,
    pub run: Option<RunRef>,
    pub provenance: BTreeMap<EvidenceProducer, EvidenceProvenance>,
    pub coverage: Option<PathBuf>,
    pub ledger: LedgerTarget,
    pub run_record: Option<PathBuf>,
}
Expand description

What to record, and where from.

Both sources are optional and independent — a run of the suite, a run of the crate, or one invocation recording both — but a request that names neither is refused rather than recording an empty run as if nothing had failed.

use majordomus_cli::evidence::{record, Origin, RecordRequest};

let nothing = RecordRequest::default();
let root = tempfile::tempdir().unwrap();
let refused = record(root.path(), &nothing).unwrap_err().to_string();
assert!(refused.contains("nothing to record"), "{refused}");

let suite_run =
    RecordRequest { suite: Some("tmp/run.tsv".into()), ..RecordRequest::new(Origin::Ci) };
assert_eq!(suite_run.origin, Origin::Ci);
assert_eq!(suite_run.suite.as_deref(), Some(std::path::Path::new("tmp/run.tsv")));

§Example

use majordomus_cli::evidence::{Origin, RecordRequest};
let r = RecordRequest::new(Origin::Ci);
assert_eq!(r.origin, Origin::Ci);

Fields§

§suite: Option<PathBuf>

The runner’s TSV report, when a suite run is being recorded.

§crate_output: Option<PathBuf>

cargo test’s output, when a crate run is being recorded.

§origin: Origin

Where the run happened.

§run: Option<RunRef>

The continuous-integration run to stamp every execution with, when there is one.

§provenance: BTreeMap<EvidenceProducer, EvidenceProvenance>

What each report’s run measured about its checkout, by producer: values, not paths, so a runner can pass the measurement it just took.

§coverage: Option<PathBuf>

A coverage summary (scripts/rust-coverage --summary-json), when one is recorded.

§ledger: LedgerTarget

The ledger the executions are merged into.

§run_record: Option<PathBuf>

Where to write the run record as well, when asked.

Implementations§

Source§

impl RecordRequest

Source

pub fn new(origin: Origin) -> RecordRequest

A recording of nothing yet, from origin, into the tracked ledger: the base every request is built on, so that a field added later breaks no caller.

use majordomus_cli::evidence::{LedgerTarget, Origin, RecordRequest};
let r = RecordRequest { suite: Some("run.tsv".into()), ..RecordRequest::new(Origin::Ci) };
assert_eq!((r.origin, r.ledger), (Origin::Ci, LedgerTarget::Repo));
assert!(r.provenance.is_empty() && r.coverage.is_none() && r.run_record.is_none());

Trait Implementations§

Source§

impl Clone for RecordRequest

Source§

fn clone(&self) -> RecordRequest

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RecordRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RecordRequest

Source§

fn default() -> RecordRequest

A local recording of nothing into the tracked ledger.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more