pub struct EconomicsExplanation {
pub present: bool,
pub statement: Option<String>,
pub metric: Option<EconomicsMetric>,
pub class_meaning: String,
pub methodology: Option<u32>,
pub suites: Vec<EconomicsSuiteView>,
pub pairs: Vec<EconomicsPair>,
pub excluded: Vec<EconomicsExclusion>,
pub variants: Vec<EconomicsVariant>,
pub reproduce: Vec<String>,
}Expand description
The answer of economics.explain: one metric, and everything it rests on.
A repository that declares no benchmark methodology measures nothing, so it has no
metric to explain: it is answered as economics.summary answers it — present: false,
the statement why, no metric and no number — rather than refused, because a repository
that does not benchmark itself is not a malformed request. A metric id that a declared
methodology does not have is still refused.
use majordomus_cli::economics::model::{EconomicsClass, EconomicsExplanation};
let e: EconomicsExplanation = serde_json::from_value(serde_json::json!({
"present": true,
"metric": { "id": "context_reduction_ratio", "title": "Context reduction",
"class": "derived", "inputs": "counted", "unit": "ratio",
"formula": "median over seeds of 1 - selected_tokens / candidate_tokens",
"status": "not_measured", "n": 0, "suite": "context" },
"class_meaning": "Arithmetic over observed or counted values.", "methodology": 1,
"suites": [], "pairs": [], "excluded": [], "variants": [],
"reproduce": ["majordomus economics measure --suite context"]
}))
.unwrap();
assert_eq!(e.metric.unwrap().inputs, Some(EconomicsClass::Counted));
assert!(e.pairs.is_empty(), "a counted metric rests on seeds, not on pairs");
let none: EconomicsExplanation = serde_json::from_value(serde_json::json!({
"present": false, "statement": "No verified total-token-savings claim is available",
"class_meaning": "", "suites": [], "pairs": [], "excluded": [], "variants": [],
"reproduce": []
}))
.unwrap();
assert!(none.metric.is_none() && none.methodology.is_none(), "nothing declared, no number");Fields§
§present: boolWhether a methodology is declared here at all.
statement: Option<String>Why there is nothing to explain, when present is false.
metric: Option<EconomicsMetric>The metric; absent when no methodology is declared.
class_meaning: StringWhat its class means, in the methodology’s words.
methodology: Option<u32>The methodology version; absent when none is declared.
suites: Vec<EconomicsSuiteView>The suites it draws on.
pairs: Vec<EconomicsPair>The pairs it rests on, valid or not, when it rests on pairs.
excluded: Vec<EconomicsExclusion>Runs excluded under the outlier rule.
variants: Vec<EconomicsVariant>The arms compared.
reproduce: Vec<String>How to reproduce it.
Trait Implementations§
Source§impl Clone for EconomicsExplanation
impl Clone for EconomicsExplanation
Source§fn clone(&self) -> EconomicsExplanation
fn clone(&self) -> EconomicsExplanation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EconomicsExplanation
impl Debug for EconomicsExplanation
Source§impl<'de> Deserialize<'de> for EconomicsExplanation
impl<'de> Deserialize<'de> for EconomicsExplanation
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>,
Source§impl JsonSchema for EconomicsExplanation
impl JsonSchema for EconomicsExplanation
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for EconomicsExplanation
impl PartialEq for EconomicsExplanation
Source§fn eq(&self, other: &EconomicsExplanation) -> bool
fn eq(&self, other: &EconomicsExplanation) -> bool
self and other values to be equal, and is used by ==.