pub struct LoadedState {
pub sources: SourcesFile,
pub locks: BTreeMap<InstallScope, LockFile>,
}Expand description
Pre-loaded configuration state — sources file plus both lock files.
Consolidates the repeated pattern of loading sources + both lock files at
the start of every command into a single I/O step. Command modules call
LoadedState::load once and then pass the plain data to pure logic
functions that accept no &AppContext.
Fields§
§sources: SourcesFile§locks: BTreeMap<InstallScope, LockFile>Implementations§
Source§impl LoadedState
impl LoadedState
pub fn load(ctx: &AppContext<'_>) -> Result<Self>
Sourcepub fn lock(&self, scope: InstallScope) -> &LockFile
pub fn lock(&self, scope: InstallScope) -> &LockFile
Return a reference to the lock file for the given scope.
Sourcepub fn scopes(&self) -> impl Iterator<Item = (InstallScope, &LockFile)>
pub fn scopes(&self) -> impl Iterator<Item = (InstallScope, &LockFile)>
Iterate over all scopes and their lock files (global first, then local).
Auto Trait Implementations§
impl Freeze for LoadedState
impl RefUnwindSafe for LoadedState
impl Send for LoadedState
impl Sync for LoadedState
impl Unpin for LoadedState
impl UnsafeUnpin for LoadedState
impl UnwindSafe for LoadedState
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