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. 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.
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. Round-trips what
Matrix::parse read, apart from comments, blank lines and column order.
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.