tilepad_plugin_sdk/
inspector.rs1use serde::Serialize;
2
3use crate::{
4 protocol::{ClientPluginMessage, InspectorContext},
5 session::{PluginSessionHandle, SessionError},
6};
7
8#[derive(Clone)]
11pub struct Inspector {
12 pub session: PluginSessionHandle,
14 pub ctx: InspectorContext,
16}
17
18impl Inspector {
19 pub fn send<M>(&self, msg: M) -> Result<(), SessionError>
21 where
22 M: Serialize,
23 {
24 let message = serde_json::to_value(msg)?;
25 self.session
26 .send_message(ClientPluginMessage::SendToInspector {
27 ctx: self.ctx.clone(),
28 message,
29 })
30 }
31}