[−][src]Macro funck::export
export!()
auto-implements the Funcktion
trait and generates an FFI wrapper to construct the exported structure.
The implementation of the Funcktion
trait wraps the provided callback in an panic handler
so as not to unwind through the FFI boundary. The macro also auto-generates an extern "C"
function
that constructs the provided struct and returns a raw mutable pointer to it. This constructor function
will then be used by the funcktion server to load your funcktion object.
Examples
use funck::{Request, Response, CallError}; const FUNCTION_NAME: &str = "my_function"; #[derive(Default)] pub struct MyFunck; impl MyFunck { fn some_function(&self, request: Request) -> Result<Response, CallError> { Ok(Response::new().with_text(String::from("Hello from FFI"))) } } funck::export!(MyFunck, MyFunck::some_function, FUNCTION_NAME);