pub trait JupyterKernelProtocol: Send + Sync + 'static {
    // Required methods
    fn language_info(&self) -> LanguageInfo;
    fn connected(&mut self, context: JupyterConnection);
    fn running(
        &mut self,
        code: ExecutionRequest
    ) -> impl Future<Output = ExecutionReply> + Send;

    // Provided methods
    fn running_time(&self, time: f64) -> String { ... }
    fn inspect_variables(
        &self,
        parent: Option<InspectVariableRequest>
    ) -> Vec<InspectVariable> { ... }
    fn inspect_details(&self, parent: &InspectVariable) -> Box<dyn Executed> { ... }
    fn inspect_modules(&self, total: usize) -> Vec<InspectModule> { ... }
    fn inspect_sources(&self) -> String { ... }
    fn interrupt_kernel(&self) -> Option<String> { ... }
}
Expand description

The protocol of the kernel

Required Methods§

source

fn language_info(&self) -> LanguageInfo

Get the language info of the kernel.

source

fn connected(&mut self, context: JupyterConnection)

Send

source

fn running( &mut self, code: ExecutionRequest ) -> impl Future<Output = ExecutionReply> + Send

since Generator is not stable, we use sender instead

Generator<Yield = dyn Executed, Return = ExecutionReply>

Provided Methods§

source

fn running_time(&self, time: f64) -> String

Show the running time of the code.

  • unit: seconds

You can suppress statistics by returning String::new() directly, which will not cause heap allocation.

source

fn inspect_variables( &self, parent: Option<InspectVariableRequest> ) -> Vec<InspectVariable>

Inspect the variables on right side.

Arguments
  • parent: The variable id provided previously, see [InspectVariable::variables_reference].
    • If it is empty, it is a root query.
Examples
source

fn inspect_details(&self, parent: &InspectVariable) -> Box<dyn Executed>

View and render an object’s value

source

fn inspect_modules(&self, total: usize) -> Vec<InspectModule>

Query the currently loaded modules

Arguments
  • total: The number of modules to be loaded, 0 means unlimited.
source

fn inspect_sources(&self) -> String

Query the currently loaded modules

Arguments
  • total: The number of modules to be loaded, 0 means unlimited.
source

fn interrupt_kernel(&self) -> Option<String>

Query the currently loaded modules

Arguments
  • total: The number of modules to be loaded, 0 means unlimited.

Object Safety§

This trait is not object safe.

Implementors§