pub struct Provenance {
pub molframe_version: &'static str,
pub input_source: SourceRef,
pub input_fingerprint: Option<Fingerprint>,
pub policy: AnalysisPolicy,
pub policy_fingerprint: Fingerprint,
pub profile: Option<ProfileId>,
pub algorithm: Option<AlgorithmId>,
pub parameters: AnalysisParameters,
pub schema_version: Option<DictionaryVersion>,
pub component_version: Option<DictionaryVersion>,
pub timestamp: Option<Box<str>>,
}Expand description
Everything needed to reproduce a result.
§Examples
use molframe_core::contract::{AnalysisPolicy, Provenance, SourceRef};
let policy = AnalysisPolicy::default();
let record = Provenance::new(&policy).with_source(SourceRef::path("1abc.cif"));
assert_eq!(record.profile.map(|profile| profile.as_str()), Some("molframe-default-1.0"));
assert_eq!(record.policy_fingerprint, policy.fingerprint());Fields§
§molframe_version: &'static strThe version of molframe that produced the result.
input_source: SourceRefWhere the input came from.
input_fingerprint: Option<Fingerprint>A fingerprint of the input’s bytes, where they were read.
policy: AnalysisPolicyThe policy in force.
policy_fingerprint: FingerprintA fingerprint of that policy.
profile: Option<ProfileId>The named profile, where the policy is one unaltered.
algorithm: Option<AlgorithmId>Versioned algorithm, when the result is algorithm-specific.
parameters: AnalysisParametersSorted typed parameters that can change the result.
schema_version: Option<DictionaryVersion>The version of the schema dictionary consulted.
component_version: Option<DictionaryVersion>The version of the chemical component data consulted.
timestamp: Option<Box<str>>When the analysis ran, if the caller asked for it recorded.
Excluded from every fingerprint.
Implementations§
Source§impl Provenance
impl Provenance
Sourcepub fn new(policy: &AnalysisPolicy) -> Self
pub fn new(policy: &AnalysisPolicy) -> Self
Starts a record under policy.
Sourcepub fn with_source(self, source: SourceRef) -> Self
pub fn with_source(self, source: SourceRef) -> Self
Records where the input came from.
Sourcepub const fn with_input_fingerprint(self, fingerprint: Fingerprint) -> Self
pub const fn with_input_fingerprint(self, fingerprint: Fingerprint) -> Self
Records a fingerprint of the input’s bytes.
Sourcepub fn with_timestamp(self, timestamp: impl Into<Box<str>>) -> Self
pub fn with_timestamp(self, timestamp: impl Into<Box<str>>) -> Self
Records when the analysis ran.
Sourcepub fn with_algorithm(self, algorithm: AlgorithmId) -> Self
pub fn with_algorithm(self, algorithm: AlgorithmId) -> Self
Records the versioned algorithm used by this analysis.
Sourcepub fn with_parameter(
self,
name: impl Into<Box<str>>,
value: ParameterValue,
) -> Self
pub fn with_parameter( self, name: impl Into<Box<str>>, value: ParameterValue, ) -> Self
Records or replaces one result-affecting parameter.
Sourcepub fn fingerprint(&self) -> Fingerprint
pub fn fingerprint(&self) -> Fingerprint
A fingerprint of everything that affects the result.
Two runs over the same input under the same policy agree here whatever the clock said, which is what makes the value a property of the result rather than of the occasion.
Trait Implementations§
Source§impl Clone for Provenance
impl Clone for Provenance
Auto Trait Implementations§
impl Freeze for Provenance
impl RefUnwindSafe for Provenance
impl Send for Provenance
impl Sync for Provenance
impl Unpin for Provenance
impl UnsafeUnpin for Provenance
impl UnwindSafe for Provenance
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more