#[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
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.tool: StringThe program, such as FusionSpace HPR (hpr-sim in a document an earlier build wrote).
tool_version: StringIts version.
designation: Option<String>The program’s designation in the FusionSpace product system, such as
FS-ACHERNAR · SW · TOOL 001 (FS · SW · TOOL 005 in a document an earlier build wrote);
absent in a document written before the first release, 0.1.
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
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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>,
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>
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 PartialEq for Provenance
impl PartialEq for Provenance
Source§fn eq(&self, other: &Provenance) -> bool
fn eq(&self, other: &Provenance) -> bool
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
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
§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.