Skip to main content

Approver

Trait Approver 

Source
pub trait Approver: Send + Sync {
    // Required method
    fn decide<'life0, 'life1, 'async_trait>(
        &'life0 self,
        call: &'life1 Pending,
    ) -> Pin<Box<dyn Future<Output = Decision> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn approve<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        tool: &'life1 str,
        summary: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}
Expand description

Decides whether a tool with Policy::Ask may run.

Three answers, because two is what makes an unanswered gate indistinguishable from no: a front-end that is not there (a scripted run, a closed dashboard) has to be able to say “nobody has answered” and have the loop stop rather than deny on the user’s behalf. See crate::approvals for how that answer survives the process.

Required Methods§

Source

fn decide<'life0, 'life1, 'async_trait>( &'life0 self, call: &'life1 Pending, ) -> Pin<Box<dyn Future<Output = Decision> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Provided Methods§

Source

fn approve<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, tool: &'life1 str, summary: &'life2 str, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

The yes/no form, for callers that have no third answer to give. A Defer reads as “not approved”, which is the fail-closed direction — but a caller that means to pause a run has to implement decide itself, because this loses the distinction.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§