pub struct Lockfile { /* private fields */ }Expand description
A lockfile handler that keeps track of the dependencies and their current state.
Implementations§
Source§impl Lockfile
impl Lockfile
Sourcepub fn new(project_root: &Path) -> Self
pub fn new(project_root: &Path) -> Self
Create a new Lockfile instance.
project_root is the absolute path to the project root.
You will need to call Lockfile::read to load the lockfile.
Sourcepub fn read(&mut self) -> Result<()>
pub fn read(&mut self) -> Result<()>
Loads the lockfile from the project root.
Throws an error if the lockfile does not exist.
Sourcepub fn get(&self, path: &Path) -> Option<&DepIdentifier>
pub fn get(&self, path: &Path) -> Option<&DepIdentifier>
Get the DepIdentifier for a submodule at a given path.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&PathBuf, &DepIdentifier)>
pub fn iter(&self) -> impl Iterator<Item = (&PathBuf, &DepIdentifier)>
Returns an iterator over the lockfile.
pub fn exists(&self) -> bool
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>,
Deserialize this value from the given Serde deserializer. Read more
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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