Skip to main content

NotebookRunner

Trait NotebookRunner 

Source
pub trait NotebookRunner:
    Send
    + Sync
    + 'static {
    // Required method
    fn run_cell<'life0, 'life1, 'async_trait>(
        &'life0 self,
        code: &'life1 str,
        timeout: Duration,
    ) -> Pin<Box<dyn Future<Output = Result<RunCellOutcome, RunnerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Abstract code-execution backend.

Implementors MUST be Send + Sync so they can live behind Arc<dyn ...> in crate::components::ComponentHandles.

Required Methods§

Source

fn run_cell<'life0, 'life1, 'async_trait>( &'life0 self, code: &'life1 str, timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<RunCellOutcome, RunnerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute code and return a RunCellOutcome.

timeout is a wall-clock cap; the implementation MUST kill the subprocess (or abort the work) when the timer fires and return an Outcome { print_output: <whatever was captured so far>, error: Some("Execution timed out...") }.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§