Trait hexchat_unsafe_plugin::Plugin
source · [−]pub unsafe trait Plugin<'ph> {
fn init(
&self,
ph: &mut PluginHandle<'ph>,
filename: &str,
arg: Option<&str>
) -> bool;
fn deinit(&self, ph: &mut PluginHandle<'ph>) { ... }
}
Expand description
A hexchat plugin.
Safety
Modern operating systems cannot deal with dynamic unloading when threads are involved, because we still haven’t figured out how to track which code address started a syscall that spawned a thread for some reason, so there’s no way for the dynamic loader to stop those threads when unloading.
Fortunately we can just shift that responsibility onto the unsuspecting Rust user. Because Rust is a safe language, this makes writing plugins inherently unsafe!
At least Unsafe Rust is still safer than writing C. So you have that going.
Required methods
Provided methods
fn deinit(&self, ph: &mut PluginHandle<'ph>)
fn deinit(&self, ph: &mut PluginHandle<'ph>)
Called to deinitialize the plugin.
This is always called immediately prior to Drop::drop.