pub struct Registry { /* private fields */ }Expand description
Parsed registry. BTreeMap keeps disk order deterministic.
Implementations§
Source§impl Registry
impl Registry
Sourcepub fn load() -> Result<Self>
pub fn load() -> Result<Self>
Read from the default path. A missing file yields an empty registry.
pub fn load_from(path: &Path) -> Result<Self>
pub fn save_to(&self, path: &Path) -> Result<()>
pub fn list(&self) -> Vec<&RepoEntry>
pub fn get(&self, name: &str) -> Option<&RepoEntry>
Sourcepub fn active(&self) -> Option<&RepoEntry>
pub fn active(&self) -> Option<&RepoEntry>
Active repo, if any. Returns None when the active pointer is unset or
names a repo no longer registered.
Sourcepub fn set_active(&mut self, name: &str) -> Result<()>
pub fn set_active(&mut self, name: &str) -> Result<()>
Set the active repo. Errors if no such repo is registered.
pub fn clear_active(&mut self)
Sourcepub fn register(&mut self, name: &str, path: &Path) -> Result<()>
pub fn register(&mut self, name: &str, path: &Path) -> Result<()>
Register (or update) a repo. Absolute path required; name must pass the rules in the schema doc.
Sourcepub fn remove(&mut self, name: &str) -> Result<()>
pub fn remove(&mut self, name: &str) -> Result<()>
Remove a repo. Clears the active pointer if it pointed at this name.
Sourcepub fn prune_missing(&mut self) -> Vec<RepoEntry>
pub fn prune_missing(&mut self) -> Vec<RepoEntry>
Remove every registered repo whose .asd-state.db no longer exists on
disk — the dead entries left behind by ephemeral/test databases. Returns
the removed entries (disk order) for reporting. Clears the active pointer
if it named a pruned repo.
Trait Implementations§
impl Eq for Registry
impl StructuralPartialEq for Registry
Auto Trait Implementations§
impl Freeze for Registry
impl RefUnwindSafe for Registry
impl Send for Registry
impl Sync for Registry
impl Unpin for Registry
impl UnsafeUnpin for Registry
impl UnwindSafe for Registry
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<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
Compare self to
key and return true if they are equal.