Macro findex_plugin::define_plugin
source · macro_rules! define_plugin { ($prefix:literal, $init_function:ident, $query_handler:ident) => { ... }; }
Expand description
This macro is used to define a Findex plugin.
Example usage:
use findex_plugin::{define_plugin, FResult};
use abi_stable::std_types::*;
fn init(config: &RHashMap<RString, RString>) -> RResult<(), RString> {
// Set up your plugin using the config if necessary
// Return RErr if something went wrong
// Returning this indicates that the plugin initalization is successful
ROk(())
}
fn handle_query(query: RStr) -> RVec<FResult> {
let mut result = vec![];
/* Do stuff here */
RVec::from(result)
}
define_plugin!("prefix!", init, handle_query);Refer to the README.md of this crate for more detailed explanation