pub struct CommOpen {
pub comm_id: CommId,
pub target_name: String,
pub data: Map<String, Value>,
}
Expand description
A 'comm_open'
message on the 'iopub'
channel.
See Comm Open.
Comm messages are one-way communications to update comm state, used for synchronizing widget state, or simply requesting actions of a comm’s counterpart.
Opening a Comm produces a comm_open
message, to be sent to the other side:
{
"comm_id": "u-u-i-d",
"target_name": "my_comm",
"data": {}
}
Every Comm has an ID and a target name. The code handling the message on
the receiving side is responsible for maintaining a mapping of target_name
keys to constructors. After a comm_open
message has been sent, there
should be a corresponding Comm instance on both sides. The data key is
always a object with any extra JSON information used in initialization of
the comm.
If the target_name
key is not found on the receiving side, then it should
immediately reply with a comm_close
message to avoid an inconsistent state.
Fields§
§comm_id: CommId
§target_name: String
§data: Map<String, Value>
Implementations§
Source§impl CommOpen
impl CommOpen
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 CommOpen
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};
let message = connection.recv().await?;
let child_message = CommOpen{
// ...
}.as_child_of(&message);
connection.send(child_message).await?;
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CommOpen
impl<'de> Deserialize<'de> for CommOpen
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>,
Source§impl From<CommOpen> for JupyterMessage
impl From<CommOpen> for JupyterMessage
Source§impl From<CommOpen> for JupyterMessageContent
impl From<CommOpen> for JupyterMessageContent
Auto Trait Implementations§
impl Freeze for CommOpen
impl RefUnwindSafe for CommOpen
impl Send for CommOpen
impl Sync for CommOpen
impl Unpin for CommOpen
impl UnwindSafe for CommOpen
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)