pub struct PackageLock {
pub version: String,
pub packages: Vec<LockedPackage>,
pub artifacts: Vec<LockedArtifact>,
}Expand description
Top-level lockfile structure written to shape.lock.
Fields§
§version: StringLockfile format version (currently “1”).
packages: Vec<LockedPackage>Locked packages in dependency order.
artifacts: Vec<LockedArtifact>Cached compile-time artifacts.
Implementations§
Source§impl PackageLock
impl PackageLock
Sourcepub fn read(path: &Path) -> Option<Self>
pub fn read(path: &Path) -> Option<Self>
Read a lockfile from the given path. Returns None if the file
doesn’t exist or cannot be parsed.
Sourcepub fn is_fresh(&self, deps: &HashMap<String, DependencySpec>) -> bool
pub fn is_fresh(&self, deps: &HashMap<String, DependencySpec>) -> bool
Check whether this lockfile is still fresh (matches the given deps).
A lockfile is fresh if every dependency in the spec is present in the lockfile and every locked package corresponds to a declared dependency.
Sourcepub fn upsert_artifact(
&mut self,
artifact: LockedArtifact,
) -> Result<(), String>
pub fn upsert_artifact( &mut self, artifact: LockedArtifact, ) -> Result<(), String>
Upsert a compile-time artifact by (namespace, key).
Sourcepub fn upsert_artifact_variant(
&mut self,
artifact: LockedArtifact,
) -> Result<(), String>
pub fn upsert_artifact_variant( &mut self, artifact: LockedArtifact, ) -> Result<(), String>
Upsert a compile-time artifact by (namespace, key, inputs_hash).
This is used for host-bound artifacts such as native dependency locks, where multiple variants for the same logical key may coexist across targets or fingerprints in a single committed lockfile.
Sourcepub fn artifact(
&self,
namespace: &str,
key: &str,
inputs_hash: &str,
) -> Option<&LockedArtifact>
pub fn artifact( &self, namespace: &str, key: &str, inputs_hash: &str, ) -> Option<&LockedArtifact>
Lookup artifact by (namespace, key, inputs_hash).
Sourcepub fn hash_inputs(inputs: &BTreeMap<String, String>) -> String
pub fn hash_inputs(inputs: &BTreeMap<String, String>) -> String
Compute a stable SHA-256 hash for inputs map.
Sourcepub fn artifact_inputs_hash(
inputs: BTreeMap<String, String>,
determinism: &ArtifactDeterminism,
) -> Result<String, String>
pub fn artifact_inputs_hash( inputs: BTreeMap<String, String>, determinism: &ArtifactDeterminism, ) -> Result<String, String>
Compute artifact inputs hash after applying determinism policy rules.
Trait Implementations§
Source§impl Clone for PackageLock
impl Clone for PackageLock
Source§fn clone(&self) -> PackageLock
fn clone(&self) -> PackageLock
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 PackageLock
impl Debug for PackageLock
Source§impl Default for PackageLock
impl Default for PackageLock
Source§impl<'de> Deserialize<'de> for PackageLock
impl<'de> Deserialize<'de> for PackageLock
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 PartialEq for PackageLock
impl PartialEq for PackageLock
Source§fn eq(&self, other: &PackageLock) -> bool
fn eq(&self, other: &PackageLock) -> bool
self and other values to be equal, and is used by ==.