Skip to main content

Workspace

Trait Workspace 

Source
pub trait Workspace: Send + Sync {
    // Required methods
    fn root<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = WorkspaceRoot> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn resolve<'life0, 'life1, 'async_trait>(
        &'life0 self,
        path: &'life1 WorkspacePath,
        access: WorkspaceAccess,
    ) -> Pin<Box<dyn Future<Output = Result<ResolvedPath, WorkspaceError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn read_file<'life0, 'life1, 'async_trait>(
        &'life0 self,
        path: &'life1 WorkspacePath,
        options: FileReadOptions,
    ) -> Pin<Box<dyn Future<Output = Result<FileContent, WorkspaceError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn write_file<'life0, 'async_trait>(
        &'life0 self,
        request: WriteFileRequest,
    ) -> Pin<Box<dyn Future<Output = Result<FileWriteResult, WorkspaceError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list_files<'life0, 'async_trait>(
        &'life0 self,
        query: ListFilesQuery,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<WorkspaceEntry>, WorkspaceError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn snapshot<'life0, 'async_trait>(
        &'life0 self,
        request: SnapshotRequest,
    ) -> Pin<Box<dyn Future<Output = Result<WorkspaceSnapshot, WorkspaceError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn diff<'life0, 'async_trait>(
        &'life0 self,
        request: DiffRequest,
    ) -> Pin<Box<dyn Future<Output = Result<WorkspaceDiff, WorkspaceError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn apply_patch<'life0, 'async_trait>(
        &'life0 self,
        request: PatchRequest,
    ) -> Pin<Box<dyn Future<Output = Result<PatchResult, WorkspaceError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Workspace abstraction for coding workloads.

Required Methods§

Source

fn root<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = WorkspaceRoot> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns this workspace’s root.

Source

fn resolve<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 WorkspacePath, access: WorkspaceAccess, ) -> Pin<Box<dyn Future<Output = Result<ResolvedPath, WorkspaceError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Resolves a root-relative path for a specific access mode.

Source

fn read_file<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 WorkspacePath, options: FileReadOptions, ) -> Pin<Box<dyn Future<Output = Result<FileContent, WorkspaceError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Reads a file through workspace policy.

Source

fn write_file<'life0, 'async_trait>( &'life0 self, request: WriteFileRequest, ) -> Pin<Box<dyn Future<Output = Result<FileWriteResult, WorkspaceError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Writes a file through workspace policy.

Source

fn list_files<'life0, 'async_trait>( &'life0 self, query: ListFilesQuery, ) -> Pin<Box<dyn Future<Output = Result<Vec<WorkspaceEntry>, WorkspaceError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Lists files through workspace policy.

Source

fn snapshot<'life0, 'async_trait>( &'life0 self, request: SnapshotRequest, ) -> Pin<Box<dyn Future<Output = Result<WorkspaceSnapshot, WorkspaceError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Captures a lightweight snapshot of file versions.

Source

fn diff<'life0, 'async_trait>( &'life0 self, request: DiffRequest, ) -> Pin<Box<dyn Future<Output = Result<WorkspaceDiff, WorkspaceError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Diffs two snapshots.

Source

fn apply_patch<'life0, 'async_trait>( &'life0 self, request: PatchRequest, ) -> Pin<Box<dyn Future<Output = Result<PatchResult, WorkspaceError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Applies or dry-runs a structured patch.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§