pub struct Lockfile {
pub version: u32,
pub packages: Vec<LockedPackage>,
pub patches: Vec<LockedPatch>,
pub source_replacements: Vec<LockedSourceReplacement>,
}Expand description
In-memory representation of a cabin.lock.
Constructed by crate::io::parse_lockfile_str / crate::io::read_lockfile
and serialized by crate::io::render_lockfile /
crate::io::write_lockfile. The lockfile only records resolved
registry dependencies — local path packages are intentionally
not included.
Fields§
§version: u32Schema version (currently always LOCKFILE_VERSION).
packages: Vec<LockedPackage>Resolved registry packages, sorted by name for determinism.
patches: Vec<LockedPatch>Active patch entries recorded for stale-detection under
--locked. Empty for projects with no patches; old
lockfiles that omit the [[patch]] array continue to
parse cleanly thanks to #[serde(default)] on the raw
shape.
source_replacements: Vec<LockedSourceReplacement>Active source-replacement entries, recorded for the same reason. Empty for projects with no replacements.
Implementations§
Source§impl Lockfile
impl Lockfile
Sourcepub fn find(&self, name: &PackageName) -> Option<&LockedPackage>
pub fn find(&self, name: &PackageName) -> Option<&LockedPackage>
Look up a locked package by name. Linear scan — typical lockfiles are small enough that this stays cheap.
Sourcepub fn matches_patch_state(
&self,
active_patches: &[LockedPatch],
active_source_replacements: &[LockedSourceReplacement],
) -> bool
pub fn matches_patch_state( &self, active_patches: &[LockedPatch], active_source_replacements: &[LockedSourceReplacement], ) -> bool
Whether the lockfile’s recorded patch + source-replacement
arrays equal the supplied active policy. Used by
cabin <command> --locked to detect that the user changed
patch policy since the lockfile was last written: the
recorded arrays already serialize deterministically (sorted
in crate::io::render_lockfile), so a slice comparison
is the canonical staleness check and lives next to the
types it compares.
Trait Implementations§
impl Eq for Lockfile
impl StructuralPartialEq for Lockfile
Auto Trait Implementations§
impl Freeze for Lockfile
impl RefUnwindSafe for Lockfile
impl Send for Lockfile
impl Sync for Lockfile
impl Unpin for Lockfile
impl UnsafeUnpin for Lockfile
impl UnwindSafe for Lockfile
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<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.