pub struct LockFile {
pub dependencies: BTreeMap<String, LockFileDep>,
pub packages: BTreeMap<EntryName, LockFileEntry>,
}Expand description
A lock file, specifying versions and names for all recursive dependencies.
This defines the on-disk format for lock files.
§Open question
There’s one big open question about the lock file: should it contain information
about path dependencies (and their recursive dependencies)? If it does, you
can immediately derive the PackageMap from the lock file, meaning that if the
interpreter gets the lock file then it can do everything else from there,
without doing any package resolution. So that’s nice.
The problem with putting information about path dependencies in the lock file is that path dependencies can change without notice, making the lock file stale. So the interpreter didn’t have to do much work, but it ended up running on old information.
I think the decision here basically comes down to what we want from the CLI interface. If we require a separate update-the-lock-file step (a la npm or poetry), it makes sense to put the path dependency info here. But if we want an auto-refresh step (a la cargo), we want to leave it out.
Fields§
§dependencies: BTreeMap<String, LockFileDep>The dependencies of the current (top-level) package.
These should be sorted so that the serialization doesn’t change all the time.
packages: BTreeMap<EntryName, LockFileEntry>All packages that we know about, and the dependencies of each one.
Note that the package list is not guaranteed to be closed: path dependencies cannot have their dependencies resolved in the on-disk lockfile because they can change at any time. Some path dependencies (for example, path dependencies that are local to a git dependency repo) may have resolved dependencies.
Implementations§
Source§impl LockFile
impl LockFile
pub fn empty() -> Self
pub fn new( manifest: &ManifestFile, resolution: &Resolution, ) -> Result<Self, Error>
Sourcepub fn write(&self, path: &Path) -> Result<(), Error>
pub fn write(&self, path: &Path) -> Result<(), Error>
Write out this lock file to the filesystem.
pub fn dependency<'a>( &'a self, entry: Option<&'a LockFileEntry>, name: &str, ) -> Option<&'a LockFileDep>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for LockFile
impl<'de> Deserialize<'de> for LockFile
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>,
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,
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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> ErasedDestructor for Twhere
T: 'static,
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