feat: add cb for ffi

This commit is contained in:
Kingtous
2023-04-28 15:09:45 +08:00
parent 952598af25
commit 5c0f249390
3 changed files with 38 additions and 14 deletions
+3 -5
View File
@@ -21,7 +21,7 @@ pub type NR = super::native::NativeReturnValue;
pub type PluginNativeHandlerRegistrar = NativeHandlerRegistrar<Box<dyn Callable + Send + Sync>>;
lazy_static! {
static ref NATIVE_HANDLERS_REGISTRAR: Arc<PluginNativeHandlerRegistrar> =
pub static ref NATIVE_HANDLERS_REGISTRAR: Arc<PluginNativeHandlerRegistrar> =
Arc::new(PluginNativeHandlerRegistrar::default());
}
@@ -34,6 +34,7 @@ impl Default for PluginNativeHandlerRegistrar {
fn default() -> Self {
Self {
handlers: Arc::new(RwLock::new(vec![Box::new(
// Add prebuilt native handlers here.
PluginNativeSessionHandler::default(),
)])),
}
@@ -104,10 +105,7 @@ where
}
}
impl<C> Callable for NativeHandlerRegistrar<C>
where
C: Callable,
{
impl Callable for PluginNativeHandlerRegistrar {
fn call(
&self,
method: &String,