summaryrefslogtreecommitdiff
path: root/src/types.rs
diff options
context:
space:
mode:
authorAlex Orlenko <zxteam@protonmail.com>2020-05-22 00:35:03 +0100
committerAlex Orlenko <zxteam@protonmail.com>2020-06-06 16:07:16 +0100
commitc3822219e0a25d0b564f0e7a766b85aa5719d77d (patch)
treec1fad1dc25079a8d24772a1f5adf4af3d25d7c50 /src/types.rs
parentf6da437d8b21de362dfcd78393139e293f0914e8 (diff)
downloadmlua-c3822219e0a25d0b564f0e7a766b85aa5719d77d.zip
Add hooks support (based on rlua v0.17 implementation)
This feature works on lua54, lua53, lua52 and lua51 only. LuaJIT is unstable.
Diffstat (limited to 'src/types.rs')
-rw-r--r--src/types.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/types.rs b/src/types.rs
index 1aa43d5..70d1139 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -1,3 +1,4 @@
+use std::cell::RefCell;
use std::os::raw::{c_int, c_void};
use std::sync::{Arc, Mutex};
use std::{fmt, mem, ptr};
@@ -7,6 +8,7 @@ use futures_core::future::LocalBoxFuture;
use crate::error::Result;
use crate::ffi;
+use crate::hook::Debug;
use crate::lua::Lua;
use crate::util::{assert_stack, StackGuard};
use crate::value::MultiValue;
@@ -27,6 +29,8 @@ pub(crate) type Callback<'lua, 'a> =
pub(crate) type AsyncCallback<'lua, 'a> =
Box<dyn Fn(&'lua Lua, MultiValue<'lua>) -> LocalBoxFuture<'lua, Result<MultiValue<'lua>>> + 'a>;
+pub(crate) type HookCallback = Arc<RefCell<dyn FnMut(&Lua, Debug) -> Result<()>>>;
+
#[cfg(feature = "send")]
pub trait MaybeSend: Send {}
#[cfg(feature = "send")]