mod error;
mod handle;
mod hook;
#[cfg(feature = "pool")]
mod pool;
mod task;
mod thread;
#[cfg(feature = "tokio")]
mod async_isle;
#[cfg(all(feature = "pool", feature = "tokio"))]
mod async_pool;
#[cfg(feature = "tokio")]
mod async_task;
pub use error::IsleError;
pub use handle::Isle;
pub use hook::CancelToken;
pub use task::Task;
#[cfg(feature = "pool")]
pub use pool::{IslePool, PoolConfig, PoolStrategy, PooledIsle};
#[cfg(feature = "tokio")]
pub use async_isle::{AsyncIsle, AsyncIsleBuilder, AsyncIsleDriver};
#[cfg(all(feature = "pool", feature = "tokio"))]
pub use async_pool::{AsyncIslePool, AsyncPooledIsle};
#[cfg(feature = "tokio")]
pub use async_task::AsyncTask;
pub(crate) type ExecFn = Box<dyn FnOnce(&mlua::Lua) -> Result<String, IsleError> + Send>;
pub(crate) type ResultTx = std::sync::mpsc::Sender<Result<String, IsleError>>;
pub(crate) enum Request {
Eval {
code: String,
cancel: CancelToken,
tx: ResultTx,
},
Call {
func: String,
args: Vec<String>,
cancel: CancelToken,
tx: ResultTx,
},
Exec {
f: ExecFn,
cancel: CancelToken,
tx: ResultTx,
},
Shutdown,
}