Function tarantool::proc::module_path
source · pub fn module_path(sym: *const ()) -> Option<&'static Path>
Expand description
Returns a path to the dynamically linked ojbect in which the symbol pointed
to by sym
is defined.
This can be used to dynamically figure out the module name for tarantool’s
stored procedure definition, for example by passing in a pointer to the
function defined using #[
tarantool::proc
]
macro attribute, but is
NOT GUARANTEED TO WORK.
use tarantool::proc::module_path;
#[tarantool::proc]
fn my_proc() -> i32 {
69
}
let path = module_path(my_proc as _).unwrap();
let filename = path.file_stem().unwrap();
assert_eq!(filename, std::ffi::OsStr::new("libmy_library"));