use crate::compilers::CompiledCode;
use std::fmt::Debug;
#[cfg(all(feature = "jailed", feature = "native"))]
pub mod jailed_runtime;
#[cfg(feature = "native")]
pub mod native_runtime;
#[cfg(feature = "wasm")]
pub mod wasm_runtime;
pub trait CodeRuntime: Send + Sync + Sized {
type Config: Send + Sync + Sized + Debug + Clone + Default;
type AdditionalData: Send + Sync + Sized + Debug + Clone + Default;
type Error: Send + Sync + Sized + 'static;
fn run(
&self,
code: &CompiledCode<Self>,
config: Self::Config,
) -> Result<ExecutionResult, Self::Error>;
}
#[derive(Debug, Clone)]
pub struct ExecutionResult {
pub stdout: Option<String>,
pub stderr: Option<String>,
pub time_taken: std::time::Duration,
pub exit_code: i32,
}