pub struct GeneratedArtifact {
pub path: String,
pub content: String,
pub kind: ArtifactKind,
pub source_hash: String,
pub morphism_chain: Vec<String>,
}Expand description
A single generated file from a backend.
The source_hash and morphism_chain fields carry provenance —
they answer “where did this file come from?” in a machine-readable
form. They are populated automatically by the blanket
Morphism<ResourceInput, Vec<GeneratedArtifact>> impl on every
Backend, so handwritten backend code rarely has to set them.
Both default to empty so the addition is non-breaking for consumers that construct artifacts directly.
Fields§
§path: StringRelative output path for the file.
content: StringFile content.
kind: ArtifactKindWhat kind of artifact this is.
source_hash: StringContent hash (lowercase hex, 64 chars) of the source IR value this artifact was rendered from. Empty string when unattached.
morphism_chain: Vec<String>Ordered list of morphism names applied to produce this artifact. First element is the outermost morphism (typically the Backend name); last is the innermost. Empty when unattached.
Implementations§
Source§impl GeneratedArtifact
impl GeneratedArtifact
Sourcepub fn new(
path: impl Into<String>,
content: impl Into<String>,
kind: ArtifactKind,
) -> Self
pub fn new( path: impl Into<String>, content: impl Into<String>, kind: ArtifactKind, ) -> Self
Create a new artifact with the given path, content, and kind. Provenance fields default to empty.
Sourcepub fn with_provenance(
self,
source_hash: impl Into<String>,
morphism_chain: Vec<String>,
) -> Self
pub fn with_provenance( self, source_hash: impl Into<String>, morphism_chain: Vec<String>, ) -> Self
Attach provenance: record the source IR’s content hash and the
morphism chain that produced this artifact. Returns self for
method chaining.
Sourcepub fn has_provenance(&self) -> bool
pub fn has_provenance(&self) -> bool
Whether this artifact carries a source-hash attestation.
Trait Implementations§
Source§impl Clone for GeneratedArtifact
impl Clone for GeneratedArtifact
Source§impl Debug for GeneratedArtifact
impl Debug for GeneratedArtifact
Source§impl Default for GeneratedArtifact
impl Default for GeneratedArtifact
Source§impl<'de> Deserialize<'de> for GeneratedArtifact
impl<'de> Deserialize<'de> for GeneratedArtifact
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>,
Source§impl Display for GeneratedArtifact
impl Display for GeneratedArtifact
impl Eq for GeneratedArtifact
Source§impl PartialEq for GeneratedArtifact
impl PartialEq for GeneratedArtifact
Source§impl Serialize for GeneratedArtifact
impl Serialize for GeneratedArtifact
impl StructuralPartialEq for GeneratedArtifact
Auto Trait Implementations§
impl Freeze for GeneratedArtifact
impl RefUnwindSafe for GeneratedArtifact
impl Send for GeneratedArtifact
impl Sync for GeneratedArtifact
impl Unpin for GeneratedArtifact
impl UnsafeUnpin for GeneratedArtifact
impl UnwindSafe for GeneratedArtifact
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.