pub trait ScriptExecutor:
Send
+ Sync
+ Any {
// Required methods
fn as_any(&self) -> &dyn Any;
fn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
input: MonitorMatch,
timeout_ms: &'life1 u32,
args: Option<&'life2 [String]>,
from_custom_notification: bool,
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}
Expand description
A trait that defines the interface for executing custom scripts in different languages. Implementors must be both Send and Sync to ensure thread safety.
Required Methods§
Sourcefn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
input: MonitorMatch,
timeout_ms: &'life1 u32,
args: Option<&'life2 [String]>,
from_custom_notification: bool,
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
input: MonitorMatch,
timeout_ms: &'life1 u32,
args: Option<&'life2 [String]>,
from_custom_notification: bool,
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Executes the script with the given MonitorMatch input.
§Arguments
input
- A MonitorMatch instance containing the data to be processed by the scripttimeout_ms
- The timeout for the script execution in millisecondsargs
- Additional arguments passed to the scriptfrom_custom_notification
- Whether the script is from a custom notification
§Returns
Result<bool, anyhow::Error>
- Returns true/false based on script execution or an error