Docs.rs
  • jupyter-protocol-0.8.1
    • jupyter-protocol 0.8.1
    • Permalink
    • Docs.rs crate page
    • BSD-3-Clause
    • Links
    • Repository
    • crates.io
    • Source
    • Owners
    • bartlomieju
    • rgbkrk
    • Dependencies
      • anyhow ^1 normal
      • async-trait ^0.1.68 normal
      • bytes ^1 normal
      • chrono ^0.4 normal
      • futures ^0.3 normal
      • serde ^1 normal
      • serde_json ^1 normal
      • uuid ^1 normal
    • Versions
    • 27.16% of the crate is documented
  • Platform
    • i686-pc-windows-msvc
    • i686-unknown-linux-gnu
    • x86_64-apple-darwin
    • x86_64-pc-windows-msvc
    • x86_64-unknown-linux-gnu
  • Feature flags
  • docs.rs
    • About docs.rs
    • Privacy policy
  • Rust
    • Rust website
    • The Book
    • Standard Library API Reference
    • Rust by Example
    • The Cargo Guide
    • Clippy Documentation

Crate jupyter_protocol

jupyter_protocol0.8.1

  • All Items

Sections

  • Jupyter Protocol
    • Main Components
    • Usage

Crate Items

  • Re-exports
  • Modules
  • Structs
  • Traits

Crates

  • jupyter_protocol

Crate jupyter_protocol

Source
Expand description

§Jupyter Protocol

This crate provides a complete implementation of the Jupyter messaging protocol, as specified in the Jupyter Client documentation.

It includes types and structures for all Jupyter message types, as well as utilities for working with Jupyter kernels and clients.

§Main Components

  • JupyterMessage: The main message type, encompassing all Jupyter protocol messages.
  • JupyterMessageContent: An enum representing the various content types for Jupyter messages.
  • Media: Represents rich media content (MIME bundles) in Jupyter messages.
  • ConnectionInfo: Contains information needed to connect to a Jupyter kernel.

§Usage

Here’s a basic example of creating and working with Jupyter messages:

use jupyter_protocol::{JupyterMessage, ExecuteRequest, JupyterMessageContent};

// Create an execute request
let execute_request = ExecuteRequest::new("print('Hello, world!')".to_string());

// Convert it to a JupyterMessage
let message: JupyterMessage = execute_request.into();

// You can then send this message using your preferred transport layer

// When receiving messages, you can match on the content type:
match message.content {
    JupyterMessageContent::ExecuteRequest(req) => {
        println!("Received execute request with code: {}", req.code);
    },
    _ => println!("Received other message type"),
}

For more detailed examples and usage information, see the documentation for individual modules and types.

Re-exports§

pub use connection_info::ConnectionInfo;
pub use connection_info::Transport;
pub use messaging::*;
pub use media::*;

Modules§

connection_info
Defines structures and functions for Jupyter kernel connection information.
media
Provides types and utilities for working with rich media content in Jupyter messages.
messaging
Defines the core message types and structures for the Jupyter messaging protocol.

Structs§

ExecutionCount
Represents a monotonically increasing counter for tracking the number of code executions in a Jupyter session. This count is maintained across all executions, including those in notebook cells and via terminal execute_requests.
JupyterKernelspec
Represents the contents of a Jupyter JSON kernelspec file.

Traits§

JupyterConnection

Results

Settings
Help
    struct
    jupyter_protocol::media::Media
    A Media is a collection of data associated with different …
    module
    jupyter_protocol::media
    Provides types and utilities for working with rich media …
    enum
    jupyter_protocol::media::MediaType
    An enumeration representing various Media types, otherwise …
    struct field
    jupyter_protocol::media::datatable::TabularDataResource::mediatype
    function
    jupyter_protocol::media::serialize_media_for_wire
    function
    jupyter_protocol::media::serialize_media_for_notebook
    function
    jupyter_protocol::media::serialize_media_with_options
    method
    jupyter_protocol::messaging::DisplayData::new
    Media -> DisplayData
    struct field
    jupyter_protocol::media::Media::content
    Media -> Vec
    A map of Media types to their corresponding data, …
    method
    jupyter_protocol::messaging::ExecuteResult::new
    ExecutionCount, Media -> ExecuteResult
    method
    jupyter_protocol::media::Media::clone
    &Media -> Media
    method
    jupyter_protocol::messaging::UpdateDisplayData::new
    Media, &str -> UpdateDisplayData
    method
    jupyter_protocol::media::Media::serialize
    &Media, __S -> Result
    function
    jupyter_protocol::media::serialize_media_for_notebook
    &Media, S -> Result
    method
    jupyter_protocol::media::Media::fmt
    &Media, &mut Formatter -> Result
    method
    jupyter_protocol::media::Media::richest
    &Media, fn (&MediaType) -> usize -> Option<&MediaType>
    Find the richest media type in the bundle, based on the …
    method
    jupyter_protocol::media::Media::default
    -> Media
    struct field
    jupyter_protocol::messaging::DisplayData::data
    DisplayData -> Media
    struct field
    jupyter_protocol::messaging::UpdateDisplayData::data
    UpdateDisplayData -> Media
    struct field
    jupyter_protocol::messaging::ExecuteResult::data
    ExecuteResult -> Media
    struct field
    jupyter_protocol::messaging::InspectReply::data
    InspectReply -> Media
    struct field
    jupyter_protocol::messaging::Payload::Page::data
    Page -> Media
    method
    jupyter_protocol::media::Media::from
    MediaType -> Media
    method
    jupyter_protocol::media::Media::new
    Vec<MediaType> -> Media
    method
    jupyter_protocol::media::Media::deserialize
    __D -> Result<Media>
    method
    jupyter_protocol::media::Media::clone
    &Media -> Media