pub struct InputRequest {
pub prompt: String,
pub password: bool,
}
Expand description
Request for input from the frontend.
This message is sent by the kernel when it needs to prompt the user for input.
It’s typically used to implement functions like Python’s input()
or R’s readline()
.
Fields§
§prompt: String
§password: bool
Implementations§
Source§impl InputRequest
impl InputRequest
Sourcepub fn as_child_of(&self, parent: &JupyterMessage) -> JupyterMessage
pub fn as_child_of(&self, parent: &JupyterMessage) -> JupyterMessage
Create a new JupyterMessage
, assigning the parent for a InputRequest
message.
This method creates a new JupyterMessage
with the right content, parent header, and zmq identities, making
it suitable for sending over ZeroMQ.
§Example
use jupyter_protocol::messaging::{JupyterMessage, JupyterMessageContent};
use jupyter_protocol::InputRequest;
let parent_message = JupyterMessage::new(jupyter_protocol::UnknownMessage {
msg_type: "example".to_string(),
content: serde_json::json!({ "key": "value" }),
}, None);
let child_message = InputRequest{
..Default::default()
}.as_child_of(&parent_message);
// Next you would send the `child_message` over the connection
Trait Implementations§
Source§impl Clone for InputRequest
impl Clone for InputRequest
Source§fn clone(&self) -> InputRequest
fn clone(&self) -> InputRequest
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for InputRequest
impl Debug for InputRequest
Source§impl Default for InputRequest
impl Default for InputRequest
Source§impl<'de> Deserialize<'de> for InputRequest
impl<'de> Deserialize<'de> for InputRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<InputRequest> for JupyterMessage
impl From<InputRequest> for JupyterMessage
Source§impl From<InputRequest> for JupyterMessageContent
impl From<InputRequest> for JupyterMessageContent
Source§fn from(content: InputRequest) -> Self
fn from(content: InputRequest) -> Self
Create a new JupyterMessageContent
for a InputRequest
.
Auto Trait Implementations§
impl Freeze for InputRequest
impl RefUnwindSafe for InputRequest
impl Send for InputRequest
impl Sync for InputRequest
impl Unpin for InputRequest
impl UnwindSafe for InputRequest
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