Skip to main content

FileApprovalGate

Trait FileApprovalGate 

Source
pub trait FileApprovalGate: Send + Sync {
    // Required methods
    fn approve_write<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        path: &'life1 str,
        before: Option<String>,
        after: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn approve_delete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        path: &'life1 str,
        recursive: bool,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Embedder-supplied approval callback used by ApprovalGatingFileStore.

Implementations decide how to ask the user (TUI prompt, web confirmation, auto-approve, OS notification, etc.). The store passes raw paths and the before/after content for writes so the implementation can render diffs.

Required Methods§

Source

fn approve_write<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, path: &'life1 str, before: Option<String>, after: &'life2 str, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Decide whether the proposed write may proceed.

before is the inner store’s current content, if any — None if the file does not yet exist. after is the proposed new content.

Source

fn approve_delete<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, recursive: bool, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Decide whether the proposed delete may proceed.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§