pub struct WorkspaceRegistry {
pub workspaces: Vec<WorkspaceEntry>,
}Expand description
Global workspace registry.
Serialized to / deserialized from ~/.clawft/workspaces.json.
Fields§
§workspaces: Vec<WorkspaceEntry>All known workspace entries.
Implementations§
Source§impl WorkspaceRegistry
impl WorkspaceRegistry
Sourcepub fn load(path: &Path) -> Result<Self, Box<dyn Error>>
pub fn load(path: &Path) -> Result<Self, Box<dyn Error>>
Load the registry from a JSON file, returning Default if it does
not exist.
Sourcepub fn save(&self, path: &Path) -> Result<(), Box<dyn Error>>
pub fn save(&self, path: &Path) -> Result<(), Box<dyn Error>>
Persist the registry to a JSON file, creating parent directories as needed.
Sourcepub fn find_by_name(&self, name: &str) -> Option<&WorkspaceEntry>
pub fn find_by_name(&self, name: &str) -> Option<&WorkspaceEntry>
Find an entry by workspace name.
Sourcepub fn find_by_path(&self, path: &Path) -> Option<&WorkspaceEntry>
pub fn find_by_path(&self, path: &Path) -> Option<&WorkspaceEntry>
Find an entry by filesystem path.
Sourcepub fn register(&mut self, entry: WorkspaceEntry)
pub fn register(&mut self, entry: WorkspaceEntry)
Register a workspace entry.
If an entry with the same name already exists, it is replaced.
Sourcepub fn remove_by_name(&mut self, name: &str) -> bool
pub fn remove_by_name(&mut self, name: &str) -> bool
Remove a workspace entry by name.
Returns true if an entry was found and removed.
Trait Implementations§
Source§impl Clone for WorkspaceRegistry
impl Clone for WorkspaceRegistry
Source§fn clone(&self) -> WorkspaceRegistry
fn clone(&self) -> WorkspaceRegistry
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WorkspaceRegistry
impl Debug for WorkspaceRegistry
Source§impl Default for WorkspaceRegistry
impl Default for WorkspaceRegistry
Source§fn default() -> WorkspaceRegistry
fn default() -> WorkspaceRegistry
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for WorkspaceRegistry
impl<'de> Deserialize<'de> for WorkspaceRegistry
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
Source§impl Registry for WorkspaceRegistry
impl Registry for WorkspaceRegistry
Auto Trait Implementations§
impl Freeze for WorkspaceRegistry
impl RefUnwindSafe for WorkspaceRegistry
impl Send for WorkspaceRegistry
impl Sync for WorkspaceRegistry
impl Unpin for WorkspaceRegistry
impl UnsafeUnpin for WorkspaceRegistry
impl UnwindSafe for WorkspaceRegistry
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