pub struct ProjectRegistry {
pub project: Vec<ProjectEntry>,
}Expand description
Global registry of indexed cqs projects
Fields§
§project: Vec<ProjectEntry>Implementations§
Source§impl ProjectRegistry
impl ProjectRegistry
Sourcepub fn load() -> Result<Self, ProjectError>
pub fn load() -> Result<Self, ProjectError>
Load registry from default location (~/.config/cqs/projects.toml)
Sourcepub fn save(&self) -> Result<(), ProjectError>
pub fn save(&self) -> Result<(), ProjectError>
Save registry to default location
Sourcepub fn register(
&mut self,
name: String,
path: PathBuf,
) -> Result<(), ProjectError>
pub fn register( &mut self, name: String, path: PathBuf, ) -> Result<(), ProjectError>
Register a project (replaces existing entry with same name)
Sourcepub fn remove(&mut self, name: &str) -> Result<bool, ProjectError>
pub fn remove(&mut self, name: &str) -> Result<bool, ProjectError>
Removes a project by name from the collection and persists the changes to storage.
§Arguments
name- The name of the project to remove
§Returns
Returns Ok(true) if a project with the given name was found and removed, or Ok(false) if no matching project exists. Returns Err(ProjectError) if saving the updated collection to storage fails.
§Errors
Returns a ProjectError if the save operation fails while persisting the removal to storage.
Trait Implementations§
Source§impl Debug for ProjectRegistry
impl Debug for ProjectRegistry
Source§impl Default for ProjectRegistry
impl Default for ProjectRegistry
Source§fn default() -> ProjectRegistry
fn default() -> ProjectRegistry
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ProjectRegistry
impl<'de> Deserialize<'de> for ProjectRegistry
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 ProjectRegistry
impl RefUnwindSafe for ProjectRegistry
impl Send for ProjectRegistry
impl Sync for ProjectRegistry
impl Unpin for ProjectRegistry
impl UnsafeUnpin for ProjectRegistry
impl UnwindSafe for ProjectRegistry
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> 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