/// Emit a custom event to a plugin.
Emit a custom event to a plugin.
Emit a custom event to a plugin .
pub async fn emit_plugin<T>(
        &self,
        target: String,
        event: String,
        args: Vec<Value>,
    ) -> Result<Option<T>, ResponseError>
    where
        T: serde::de::DeserializeOwned,
    {
        let mut query = vec![Value::String(target.into()), Value::String(event.into())];
        query.extend(args.into_iter());
        self.request("plugin.emit", Some(Value::Array(query)))
            .await
            .map(|r| {
                serde_json::from_value::<_>(r.unwrap_or_default())
                    .ok()
                    .unwrap_or_default()
            })
    }
pub async fn emit_plugin < T > ( & self , target : String , event : String , args : Vec < Value > , ) -> Result < Option < T > , ResponseError > where T : serde :: de :: DeserializeOwned , { let mut query = vec ! [ Value String ( target into ( ) ) Value String ( event into ( ) ) ] ; query . extend ( args . into_iter ( ) ) ; self . request ( " " , Some ( Value :: Array ( query ) ) ) . await . map ( | r | { serde_json :: from_value :: < _ > ( r . unwrap_or_default ( ) ) . ok ( ) . unwrap_or_default ( ) } ) }
Emit a custom event to a plugin.
Emit a custom event to a plugin .
&self
target
String
event
String
args
Vec<Value>