Enum Command

Source
pub enum Command {
    KernelInfo,
    Execute {
        code: String,
        silent: bool,
        store_history: bool,
        user_expressions: HashMap<String, String>,
        allow_stdin: bool,
        stop_on_error: bool,
    },
    Inspect {
        code: String,
        cursor_pos: u64,
        detail_level: DetailLevel,
    },
    Complete {
        code: String,
        cursor_pos: u64,
    },
    History {
        output: bool,
        raw: bool,
        hist_access_type: HistoryAccessType,
        unique: bool,
    },
    IsComplete {
        code: String,
    },
    Shutdown {
        restart: bool,
    },
    CommInfo {
        target_name: Option<String>,
    },
}
Expand description

Available commands.

Variants§

§

KernelInfo

Ask for information about the running kernel

§

Execute

Execute a specific command

Fields

§code: String

Source code to be executed by the kernel, one or more lines.

§silent: bool

A boolean flag which, if true, signals the kernel to execute this code as quietly as possible. silent=true forces store_history to be false, and will not: - broadcast output on the IOPub channel - have an execute_result The default is false.

§store_history: bool

A boolean flag which, if true, signals the kernel to populate history The default is true if silent is false. If silent is true, store_history is forced to be false.

§user_expressions: HashMap<String, String>

A HashMap mapping names to expressions to be evaluated in the user’s HashMap. The rich display-data representation of each will be evaluated after execution. See the display_data content for the structure of the representation data.

§allow_stdin: bool

Some frontends do not support stdin requests. If this is true, code running in the kernel can prompt the user for input with an input_request message. If it is false, the kernel should not send these messages.

§stop_on_error: bool

A boolean flag, which, if true, does not abort the execution queue, if an exception * is encountered. This allows the queued execution of multiple execute_requests, even if they generate exceptions.

§

Inspect

Perform introspection into a piece of code.

Fields

§code: String

The code context in which introspection is requested this may be up to an entire multiline cell.

§cursor_pos: u64

The cursor position within ‘code’ (in unicode characters) where inspection is requested

§detail_level: DetailLevel

The level of detail desired. In IPython, the default (0) is equivalent to typing ‘x?’ at the prompt, 1 is equivalent to ‘x??’. The difference is up to kernels, but in IPython level 1 includes the source code if available.

§

Complete

Ask the kernel to complete the code at the cursor.

Fields

§code: String

The code context in which completion is requested this may be up to an entire multiline cell, such as ‘foo = a.isal’

§cursor_pos: u64

The cursor position within ‘code’ (in unicode characters) where completion is requested

§

History

Fetch history from the kernel.

Fields

§output: bool

If True, also return output history in the resulting dict.

§raw: bool

If True, return the raw input history, else the transformed input.

§hist_access_type: HistoryAccessType

So far, this can be range, tail or search. If hist_access_type is range, get a range of input cells. session is a number counting up each time the kernel starts; you can give a positive session number, or a negative number to count back from the current session. start and stop are line (cell) numbers within that session. If hist_access_type is ‘tail’ or ‘search’, get the last n cells. If hist_access_type is ‘search’, get cells matching the specified glob pattern (with * and ? as wildcards).

§unique: bool

If hist_access_type is ‘search’ and unique is true, do not include duplicated history. Default is false.

§

IsComplete

Ask the kernel if the current code is complete

Fields

§code: String

The code entered so far as a multiline string

§

Shutdown

Tell the kernel to shutdown.

Fields

§restart: bool

False if final shutdown, or True if shutdown precedes a restart

§

CommInfo

Fetch comm info.

Fields

§target_name: Option<String>

The target name

Trait Implementations§

Source§

impl Debug for Command

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Serialize for Command

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.