Skip to main content

EvalKernel

Trait EvalKernel 

Source
pub trait EvalKernel:
    Send
    + Sync
    + Debug {
    // Required methods
    fn language(&self) -> EvalLanguage;
    fn execute<'life0, 'life1, 'async_trait>(
        &'life0 self,
        code: &'life1 str,
        timeout: Duration,
    ) -> Pin<Box<dyn Future<Output = Result<EvalOutput, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn reset<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Persistent eval kernel contract (“Eval kernel” extension).

Required behavior: persistent Python/Bun state across calls, bounded execution, explicit reset (design table row 4).

Required Methods§

Source

fn language(&self) -> EvalLanguage

Language this kernel evaluates.

Source

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

Evaluate code in the persistent kernel state.

Source

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

Drop all kernel state; the next execute starts fresh.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§