pub(crate) struct DetailedEvalResult {
pub result: bool,
pub matched_rule_index: i64,
}
pub struct Execution {
execution_id: String,
cleanup: Option<Box<dyn FnOnce() + Send>>,
}
impl Execution {
pub(crate) fn new(execution_id: String, cleanup: impl FnOnce() + Send + 'static) -> Self {
Self {
execution_id,
cleanup: Some(Box::new(cleanup)),
}
}
pub fn execution_id(&self) -> &str {
&self.execution_id
}
pub fn end(mut self) {
if let Some(cleanup) = self.cleanup.take() {
cleanup();
}
}
}
impl Drop for Execution {
fn drop(&mut self) {
if let Some(cleanup) = self.cleanup.take() {
cleanup();
}
}
}