pub struct Registry {
pub version: u32,
pub repos: Vec<RepoEntry>,
}Expand description
Global registry of all repositories indexed by cgx, persisted at ~/.cgx/registry.json.
Fields§
§version: u32§repos: Vec<RepoEntry>Implementations§
Source§impl Registry
impl Registry
Sourcepub fn load() -> Result<Self>
pub fn load() -> Result<Self>
Load the registry from ~/.cgx/registry.json, creating it if absent.
Sourcepub fn touch_path(path: &Path) -> Result<()>
pub fn touch_path(path: &Path) -> Result<()>
Bump last_used_at on the entry whose canonical path matches path.
Persists the registry on success. Silent no-op if the path isn’t registered.
Sourcepub fn find_by_path(&self, path: &Path) -> Option<&RepoEntry>
pub fn find_by_path(&self, path: &Path) -> Option<&RepoEntry>
Look up a repo by its canonical on-disk path.
Sourcepub fn find_by_id(&self, id: &str) -> Option<&RepoEntry>
pub fn find_by_id(&self, id: &str) -> Option<&RepoEntry>
Look up a repo by its stable SHA-derived id.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Registry
impl<'de> Deserialize<'de> for Registry
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 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<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