scanner: make plugin interface ffi-safe with handle-based registry
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I8e4790db3cc29f84f4e0d7d8eff36c2c6a6a6964
This commit is contained in:
parent
4f9c7057ff
commit
f4961c7f95
9 changed files with 93 additions and 44 deletions
|
|
@ -1,4 +1,3 @@
|
|||
#![allow(improper_ctypes)]
|
||||
use pscand_core::helpers::SensorHelper;
|
||||
use pscand_core::scanner::{MetricValue, Scanner};
|
||||
use pscand_core::Result;
|
||||
|
|
@ -7,9 +6,9 @@ use std::time::Duration;
|
|||
|
||||
struct SensorScanner;
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn pscand_scanner() -> Box<dyn Scanner> {
|
||||
Box::new(SensorScanner)
|
||||
#[no_mangle]
|
||||
pub extern "C" fn pscand_scanner() -> *mut std::os::raw::c_void {
|
||||
Box::into_raw(Box::new(SensorScanner)) as *mut std::os::raw::c_void
|
||||
}
|
||||
|
||||
impl Default for SensorScanner {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue