pub enum EconomicsClass {
Observed,
Counted,
Derived,
Estimated,
Counterfactual,
}Expand description
How a number came to be. The classes are ordered from strongest to weakest, and a value computed from several inputs is never stronger than the weakest of them.
use majordomus_cli::economics::model::EconomicsClass;
assert_eq!(serde_json::to_value(EconomicsClass::Counterfactual).unwrap(), "counterfactual");
let parsed: EconomicsClass = serde_json::from_value("observed".into()).unwrap();
assert!(parsed < EconomicsClass::Estimated, "a stronger class sorts first");Variants§
Observed
Returned by the provider or its harness at run time and recorded unmodified.
Counted
Computed deterministically from bytes on disk with a named, pinned tokenizer.
Derived
Arithmetic over observed or counted values.
Estimated
A number standing in for one nobody measured. Never compared, never published.
Counterfactual
What a mechanism would have avoided, modelled rather than observed.
Implementations§
Source§impl EconomicsClass
impl EconomicsClass
Sourcepub fn weakest(self, other: EconomicsClass) -> EconomicsClass
pub fn weakest(self, other: EconomicsClass) -> EconomicsClass
The weaker of two classes: what a value computed from both may call itself.
use majordomus_cli::economics::model::EconomicsClass::*;
assert_eq!(Observed.weakest(Counted), Counted);
assert_eq!(Counterfactual.weakest(Observed), Counterfactual);Sourcepub fn is_measurement(self) -> bool
pub fn is_measurement(self) -> bool
Whether a value of this class is a measurement a comparison may rest on: observed, counted, or derived from those. Estimates and counterfactuals are not.
use majordomus_cli::economics::model::EconomicsClass;
assert!(EconomicsClass::Counted.is_measurement());
assert!(!EconomicsClass::Estimated.is_measurement());Trait Implementations§
Source§impl Clone for EconomicsClass
impl Clone for EconomicsClass
Source§fn clone(&self) -> EconomicsClass
fn clone(&self) -> EconomicsClass
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 moreimpl Copy for EconomicsClass
Source§impl Debug for EconomicsClass
impl Debug for EconomicsClass
Source§impl<'de> Deserialize<'de> for EconomicsClass
impl<'de> Deserialize<'de> for EconomicsClass
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
impl Eq for EconomicsClass
Source§impl Hash for EconomicsClass
impl Hash for EconomicsClass
Source§impl JsonSchema for EconomicsClass
impl JsonSchema for EconomicsClass
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 Ord for EconomicsClass
impl Ord for EconomicsClass
Source§fn cmp(&self, other: &EconomicsClass) -> Ordering
fn cmp(&self, other: &EconomicsClass) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for EconomicsClass
impl PartialEq for EconomicsClass
Source§fn eq(&self, other: &EconomicsClass) -> bool
fn eq(&self, other: &EconomicsClass) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for EconomicsClass
impl PartialOrd for EconomicsClass
Source§impl Serialize for EconomicsClass
impl Serialize for EconomicsClass
impl StructuralPartialEq for EconomicsClass
Auto Trait Implementations§
impl Freeze for EconomicsClass
impl RefUnwindSafe for EconomicsClass
impl Send for EconomicsClass
impl Sync for EconomicsClass
impl Unpin for EconomicsClass
impl UnsafeUnpin for EconomicsClass
impl UnwindSafe for EconomicsClass
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.