pub struct CommMsg {
pub comm_id: CommId,
pub data: Map<String, Value>,
}
Expand description
A comm_msg
message on the iopub
channel.
Comm messages are one-way communications to update comm state, used for synchronizing widget state, or simply requesting actions of a comm’s counterpart.
Essentially, each comm pair defines their own message specification implemented inside the data object.
There are no expected replies.
{
"comm_id": "u-u-i-d",
"data": {}
}
Fields§
§comm_id: CommId
§data: Map<String, Value>
Implementations§
Source§impl CommMsg
impl CommMsg
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 CommMsg
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::CommMsg;
let parent_message = JupyterMessage::new(jupyter_protocol::UnknownMessage {
msg_type: "example".to_string(),
content: serde_json::json!({ "key": "value" }),
}, None);
let child_message = CommMsg{
..Default::default()
}.as_child_of(&parent_message);
// Next you would send the `child_message` over the connection
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CommMsg
impl<'de> Deserialize<'de> for CommMsg
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<CommMsg> for JupyterMessage
impl From<CommMsg> for JupyterMessage
Source§impl From<CommMsg> for JupyterMessageContent
impl From<CommMsg> for JupyterMessageContent
Auto Trait Implementations§
impl Freeze for CommMsg
impl RefUnwindSafe for CommMsg
impl Send for CommMsg
impl Sync for CommMsg
impl Unpin for CommMsg
impl UnwindSafe for CommMsg
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