Skip to main content

Workspace

Trait Workspace 

Source
pub trait Workspace: Send + Sync {
    // Required methods
    fn create<'life0, 'life1, 'async_trait>(
        &'life0 self,
        cfg: &'life1 WorkspaceCreateConfig,
    ) -> Pin<Box<dyn Future<Output = Result<PathBuf>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn destroy<'life0, 'life1, 'async_trait>(
        &'life0 self,
        workspace_path: &'life1 Path,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn exists<'life0, 'life1, 'async_trait>(
        &'life0 self,
        workspace_path: &'life1 Path,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

How a session’s working directory is materialized (git worktree, full clone, …).

Required Methods§

Source

fn create<'life0, 'life1, 'async_trait>( &'life0 self, cfg: &'life1 WorkspaceCreateConfig, ) -> Pin<Box<dyn Future<Output = Result<PathBuf>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create an isolated copy of the repo on a new branch, returning its path.

Source

fn destroy<'life0, 'life1, 'async_trait>( &'life0 self, workspace_path: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Provided Methods§

Source

fn exists<'life0, 'life1, 'async_trait>( &'life0 self, workspace_path: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Report whether a previously-created workspace is still usable at workspace_path. Session restore uses this to decide whether the session can be brought back up or whether the user has to spawn a fresh one.

The default impl treats any directory that exists on disk as usable — good enough for plugins that don’t have backend-specific validation. Plugins backed by git (worktree / clone) override this to also verify the directory is still a working tree (catches the case where someone rm -rf’d .git or the repo was corrupted).

Implementors§