#[non_exhaustive]pub struct Provenance {
pub tool: String,
pub tool_version: String,
pub designation: Option<String>,
pub source: Option<Source>,
}Expand description
Which program wrote a document, and from what.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.tool: StringThe program, such as hpr-sim.
tool_version: StringIts version.
designation: Option<String>The program’s designation in the FusionSpace product system, such as
FS · SW · TOOL 005; absent in a document written before hpr-sim 0.1’s first release.
source: Option<Source>The file the design was read from, if it was read from one.
Implementations§
Source§impl Provenance
impl Provenance
Sourcepub fn hpr(source: Option<Source>) -> Self
pub fn hpr(source: Option<Source>) -> Self
This program, at this version, reading source: hpr_core::tool::NAME,
hpr_core::tool::VERSION and hpr_core::tool::DESIGNATION.
Sourcepub fn rewritten(&self) -> Self
pub fn rewritten(&self) -> Self
This provenance as a document this program writes again records it: the program fields
name this build (Provenance::hpr), and Provenance::source stays exactly as read.
A conversion writes a new file, so the program that wrote it is this one; where the
design came from doesn’t change.
use hpr_format::{DesignFile, from_json, to_json};
let bytes = include_bytes!("../../../validation/fixtures/ork/loft-demo/demo-stable.ork");
let mut read = DesignFile::from_ork(bytes)?.value;
read.provenance.tool_version = "0.0.1".to_owned();
read.provenance.designation = None;
let rewritten = read.provenance.rewritten();
assert_eq!(rewritten.tool_version, hpr_core::tool::VERSION);
assert_eq!(rewritten.designation.as_deref(), Some(hpr_core::tool::DESIGNATION));
assert_eq!(rewritten.source, read.provenance.source);Trait Implementations§
Source§impl Clone for Provenance
impl Clone for Provenance
Source§fn clone(&self) -> Provenance
fn clone(&self) -> Provenance
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 Provenance
impl Debug for Provenance
Source§impl<'de> Deserialize<'de> for Provenance
impl<'de> Deserialize<'de> for Provenance
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 Provenance
Source§impl JsonSchema for Provenance
impl JsonSchema for Provenance
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 Provenance
impl PartialEq for Provenance
Source§fn eq(&self, other: &Provenance) -> bool
fn eq(&self, other: &Provenance) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for Provenance
impl Serialize for Provenance
impl StructuralPartialEq 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
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<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
Checks if this value is equivalent to the given key. Read more
§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.