pub struct Client { /* private fields */ }
Expand description
The main Client
struct.
This handles communication between the user’s code, and the kernel itself. It abstracts the conversion of messages to and from the on-the-wire format.
§Construction methods
existing
: looks for the latest connection file and tries to connectfrom_reader
: reads connection details from a reader
§Communication with kernels
send_shell_command
: send a shell command (like running a cell’s contents)send_control_command
: send an important shell commandiopub_subscribe
: subscribe to published information from the kernelheartbeat_every
: control the heartbeat and find out if the kernel diesheartbeat
: send a heartbeat every second
Implementations§
Source§impl Client
impl Client
Sourcepub fn existing() -> Result<Self>
pub fn existing() -> Result<Self>
Connect to the latest existing connection info file.
This searches the standard runtime path for the latest kernel config file by last-modified
time. This is then loaded by using from_reader
.
let client = Client::existing()?;
Sourcepub fn from_reader<R>(reader: R) -> Result<Self>where
R: Read,
pub fn from_reader<R>(reader: R) -> Result<Self>where
R: Read,
Connect to a kernel with a definition from a specific connection info file.
This takes an std::io::Read
implementor
(e.g. a std::fs::File
).
// let file = File::open(...)?;
let client = Client::from_reader(file)?;
Sourcepub fn send_shell_command(&self, command: Command) -> Result<Response>
pub fn send_shell_command(&self, command: Command) -> Result<Response>
Send a shell command to the kernel.
Sourcepub fn send_control_command(&self, command: Command) -> Result<Response>
pub fn send_control_command(&self, command: Command) -> Result<Response>
Send a control command to the kernel.
Sourcepub fn iopub_subscribe(&self) -> Result<Receiver<Response>>
pub fn iopub_subscribe(&self) -> Result<Receiver<Response>>
Subscribe to IOPub messages.
Auto Trait Implementations§
impl Freeze for Client
impl RefUnwindSafe for Client
impl Send for Client
impl !Sync for Client
impl Unpin for Client
impl UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more