We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e864522 commit 58bc8beCopy full SHA for 58bc8be
plugins/src/lib.rs
@@ -700,15 +700,28 @@ where
700
pub fn state(&self) -> &S {
701
&self.state
702
}
703
- pub fn sender(&self) -> &tokio::sync::mpsc::Sender<serde_json::Value> {
704
- &self.sender
705
- }
706
707
708
impl<S> Plugin<S>
709
where
710
S: Send + Clone,
711
{
+ pub async fn send_custom_notification(
+ &self,
+ method: String,
712
+ v: serde_json::Value,
713
+ ) -> Result<(), Error> {
714
+ self.sender
715
+ .send(json!({
716
+ "jsonrpc": "2.0",
717
+ "method": method,
718
+ "params": {method: v},
719
+ }))
720
+ .await
721
+ .context("sending custom notification")?;
722
+ Ok(())
723
+ }
724
+
725
/// Wait for plugin shutdown
726
pub async fn join(&self) -> Result<(), Error> {
727
self.wait_handle
0 commit comments