LockFile

Struct LockFile 

Source
pub struct LockFile {
    pub locked_dependencies: Vec<LockedDependency>,
    pub lockfile_version: u32,
    pub config_hash: String,
    pub generated_at: String,
    pub config_modified: Option<String>,
}
Expand description

Lock file containing all resolved dependencies and metadata

The lock file ensures reproducible builds by recording exact versions and integrity information for all dependencies.

Fields§

§locked_dependencies: Vec<LockedDependency>

List of all locked dependencies

§lockfile_version: u32

Version of the lockfile format for compatibility

§config_hash: String

Hash of the configuration that generated this lock

§generated_at: String

Timestamp when this lock was generated (nanoseconds since epoch)

§config_modified: Option<String>

Configuration file modification time (nanoseconds since epoch)

Implementations§

Source§

impl LockFile

Source

pub fn load(path: &Path) -> Result<Self>

Load a lock file from disk

§Arguments
  • path - Path to the lock file
§Returns

Parsed lock file structure

§Errors

Returns error if file cannot be read or parsed as valid YAML

Source

pub fn save(&self, path: &Path) -> Result<()>

Save the lock file to disk

§Arguments
  • path - Path where to save the lock file
§Errors

Returns error if file cannot be written or serialized

Source

pub fn new( locked_dependencies: Vec<LockedDependency>, config_hash: String, ) -> Self

Create a new lockfile with current timestamp and version

§Arguments
  • locked_dependencies - Vector of resolved dependencies
  • config_hash - Hash of the configuration that generated this lock
Source

pub fn with_config_modified( locked_dependencies: Vec<LockedDependency>, config_hash: String, config_modified: Option<String>, ) -> Self

Create a new lockfile with config modification time

§Arguments
  • locked_dependencies - Vector of resolved dependencies
  • config_hash - Hash of the configuration
  • config_modified - Optional config file modification timestamp
Source

pub fn is_compatible_with_config(&self, config_hash: &str) -> bool

Check if this lockfile is compatible with the given config hash

Source

pub fn is_newer_than_config(&self, config_path: &Path) -> Result<bool>

Check if the lockfile is up-to-date based on config file modification time

Source

pub fn is_up_to_date( &self, config_path: &Path, current_config_hash: &str, dependencies: &[LockedDependency], ) -> Result<bool>

Enhanced lockfile validation that checks multiple criteria

Source

pub fn dependencies_match(&self, other_deps: &[LockedDependency]) -> bool

Compare two sets of locked dependencies, accounting for order independence

Source

pub fn compute_config_hash( config_content: &str, dependencies: &[DependencyConfig], ) -> String

Compute a hash of the relevant configuration that affects locking This focuses only on the dependency specifications, not formatting/comments

Source

pub fn get_config_modification_time(config_path: &Path) -> Result<String>

Get the modification time of a config file as nanoseconds since epoch

Trait Implementations§

Source§

impl Debug for LockFile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for LockFile

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for LockFile

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,