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 · 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§impl Serialize for PackageLock
impl Serialize for PackageLock
impl StructuralPartialEq for PackageLock
Auto Trait Implementations§
impl Freeze for PackageLock
impl RefUnwindSafe for PackageLock
impl Send for PackageLock
impl Sync for PackageLock
impl Unpin for PackageLock
impl UnsafeUnpin for PackageLock
impl UnwindSafe for PackageLock
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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