pub struct EconomicsMetric {Show 15 fields
pub id: String,
pub title: String,
pub class: EconomicsClass,
pub inputs: Option<EconomicsClass>,
pub unit: String,
pub formula: String,
pub not: Option<String>,
pub value: Option<f64>,
pub status: EconomicsMetricStatus,
pub n: usize,
pub distribution: Option<EconomicsDistribution>,
pub interval: Option<EconomicsInterval>,
pub suite: String,
pub evidence: Vec<String>,
pub warnings: Vec<String>,
}Expand description
One metric: its value, where it comes from, and how much it can bear.
use majordomus_cli::economics::model::{EconomicsClass, EconomicsMetric, EconomicsMetricStatus};
let m: EconomicsMetric = serde_json::from_value(serde_json::json!({
"id": "effective_token_reduction", "title": "Effective token reduction",
"class": "derived", "inputs": "observed", "unit": "ratio",
"formula": "median of 1 - treatment / control", "status": "not_measured", "n": 0,
"suite": "pilot"
}))
.unwrap();
assert_eq!(m.inputs, Some(EconomicsClass::Observed));
assert!(m.value.is_none() && m.status == EconomicsMetricStatus::NotMeasured);
assert!(serde_json::to_value(&m).unwrap().get("value").is_none(), "no value, not a zero");Fields§
§id: StringThe metric’s id.
title: StringA name.
class: EconomicsClassThe measurement class.
inputs: Option<EconomicsClass>For a derived metric, the class of what it was derived from: a reduction derived from observed usage is not the same evidence as one derived from counted bytes.
unit: Stringratio, tokens, calls.
formula: StringThe formula, in words.
not: Option<String>What the metric is not, where it is easily mistaken for something else.
value: Option<f64>The headline value; absent when nothing was measured.
status: EconomicsMetricStatusWhere it stands.
n: usizeHow many values it rests on.
distribution: Option<EconomicsDistribution>Their distribution.
interval: Option<EconomicsInterval>The interval, when enough values exist.
suite: StringThe suite.
evidence: Vec<String>The runs, pairs or seeds it rests on.
warnings: Vec<String>What a reader must know before using it.
Trait Implementations§
Source§impl Clone for EconomicsMetric
impl Clone for EconomicsMetric
Source§fn clone(&self) -> EconomicsMetric
fn clone(&self) -> EconomicsMetric
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 EconomicsMetric
impl Debug for EconomicsMetric
Source§impl<'de> Deserialize<'de> for EconomicsMetric
impl<'de> Deserialize<'de> for EconomicsMetric
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
Source§impl JsonSchema for EconomicsMetric
impl JsonSchema for EconomicsMetric
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 EconomicsMetric
impl PartialEq for EconomicsMetric
Source§fn eq(&self, other: &EconomicsMetric) -> bool
fn eq(&self, other: &EconomicsMetric) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for EconomicsMetric
impl Serialize for EconomicsMetric
impl StructuralPartialEq for EconomicsMetric
Auto Trait Implementations§
impl Freeze for EconomicsMetric
impl RefUnwindSafe for EconomicsMetric
impl Send for EconomicsMetric
impl Sync for EconomicsMetric
impl Unpin for EconomicsMetric
impl UnsafeUnpin for EconomicsMetric
impl UnwindSafe for EconomicsMetric
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