pub enum FieldProvenance {
Explicit,
Derived,
Inferred,
Unknown,
}Expand description
Where a value came from, and therefore how much weight a reader may put on it.
The four words are not degrees of confidence, they are four different relations to the repository, and the distinction that matters most is the first from the last two: a person wrote it, or a machine worked it out.
use majordomus_cli::devtask::{AttestedText, FieldProvenance};
// a value the record itself carried
let title = AttestedText::explicit("Ship it", ".ai/repo/project/issues/I0001.yaml#title");
assert_eq!(title.provenance, FieldProvenance::Explicit);
// a key the record does not have is unknown, and unknown carries no value
let missing = AttestedText::unknown(
".ai/repo/project/issues/I0001.yaml#objective",
"the record declares no `objective`",
);
assert_eq!(missing.provenance, FieldProvenance::Unknown);
assert!(missing.value.is_none());Variants§
Explicit
A person authored it, in the canonical record, under this key. The strongest thing that can be said about a value, and the only one that survives a rewrite of every derivation in this repository.
Derived
A machine worked it out from records or from git, by a rule that cannot be wrong about a repository it can read: an issue’s dependents are the issues that name it. Re-derived on every call and stored nowhere.
Inferred
A machine worked it out by a rule that can be wrong, because the relation it reads was never declared: a session belongs to an issue because its branch name contains the issue’s id. Useful, and never to be mistaken for a declaration.
Unknown
Not available. Either the record does not carry the key, or the fact lives outside
what this process may read — a live GitHub state, for one — and the field says which
in its reason. An unknown field never carries a value.
Implementations§
Source§impl FieldProvenance
impl FieldProvenance
Sourcepub fn as_str(self) -> &'static str
pub fn as_str(self) -> &'static str
The word a projection prints.
use majordomus_cli::devtask::FieldProvenance;
assert_eq!(FieldProvenance::Explicit.as_str(), "explicit");
assert_eq!(FieldProvenance::Unknown.as_str(), "unknown");Did a person write this, in the canonical record?
use majordomus_cli::devtask::FieldProvenance;
assert!(FieldProvenance::Explicit.is_authored());
assert!(!FieldProvenance::Derived.is_authored());Trait Implementations§
Source§impl Clone for FieldProvenance
impl Clone for FieldProvenance
Source§fn clone(&self) -> FieldProvenance
fn clone(&self) -> FieldProvenance
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for FieldProvenance
Source§impl Debug for FieldProvenance
impl Debug for FieldProvenance
Source§impl<'de> Deserialize<'de> for FieldProvenance
impl<'de> Deserialize<'de> for FieldProvenance
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>,
impl Eq for FieldProvenance
Source§impl Hash for FieldProvenance
impl Hash for FieldProvenance
Source§impl JsonSchema for FieldProvenance
impl JsonSchema for FieldProvenance
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 Ord for FieldProvenance
impl Ord for FieldProvenance
Source§fn cmp(&self, other: &FieldProvenance) -> Ordering
fn cmp(&self, other: &FieldProvenance) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for FieldProvenance
impl PartialEq for FieldProvenance
Source§fn eq(&self, other: &FieldProvenance) -> bool
fn eq(&self, other: &FieldProvenance) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialOrd for FieldProvenance
impl PartialOrd for FieldProvenance
Source§impl Serialize for FieldProvenance
impl Serialize for FieldProvenance
impl StructuralPartialEq for FieldProvenance
Auto Trait Implementations§
impl Freeze for FieldProvenance
impl RefUnwindSafe for FieldProvenance
impl Send for FieldProvenance
impl Sync for FieldProvenance
impl Unpin for FieldProvenance
impl UnsafeUnpin for FieldProvenance
impl UnwindSafe for FieldProvenance
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
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
key and return true if they are equal.