pub struct Matrix { /* private fields */ }Expand description
The recorded facts of one or more matrix files, and the lookup the gate performs.
Implementations§
Source§impl Matrix
impl Matrix
Sourcepub fn parse(text: &str) -> Result<Matrix, ParseError>
pub fn parse(text: &str) -> Result<Matrix, ParseError>
Read one tab-separated file (by capant’s reader; see adapter.rs). The first non-comment
line is the header; columns are matched by name, so order does not matter and unknown
columns are kept in Row::extra. Blank lines and lines starting with # are skipped.
The probe id is the probe metadata key of the file, and the test key of a Row
(the older spelling of the file is read too).
Sourcepub fn from_rows(rows: Vec<Row>) -> Matrix
pub fn from_rows(rows: Vec<Row>) -> Matrix
A matrix of exactly these rows (what a conformance run produces).
Sourcepub fn merge(&mut self, other: Matrix)
pub fn merge(&mut self, other: Matrix)
Add the rows of another file. A reader merges files; nothing is deduplicated.
Sourcepub fn to_tsv(&self) -> String
pub fn to_tsv(&self) -> String
Write the known columns, then the sorted union of unknown columns (by capant’s writer;
the probe id is written as the probe metadata key). Round-trips what Matrix::parse
read, apart from comments, blank lines and column order. A value in probed_at,
environment or inherited_from that the reader could not have produced is not written.
Sourcepub fn lookup(
&self,
subject: &CapabilityId,
backend: &str,
version: &str,
actual: &Config,
) -> Lookup
pub fn lookup( &self, subject: &CapabilityId, backend: &str, version: &str, actual: &Config, ) -> Lookup
The gate’s lookup. Rows match on subject, backend and version exactly, and on config
when every fact the row names is also in actual. Off wins: one matching no makes the
answer off even if another matching row says yes.
Sourcepub fn enabled(
&self,
subject: &CapabilityId,
backend: &str,
version: &str,
actual: &Config,
) -> bool
pub fn enabled( &self, subject: &CapabilityId, backend: &str, version: &str, actual: &Config, ) -> bool
Whether the capability is on. Anything but Lookup::On is false.