Struct hexchat_plugin::PluginHandle
[−]
[src]
pub struct PluginHandle { /* fields omitted */ }
A hexchat plugin handle
Methods
impl PluginHandle
[src]
pub fn register(&mut self, name: &str, desc: &str, ver: &str)
[src]
Registers a hexchat plugin.
pub fn ensure_valid_context<F, R>(&mut self, f: F) -> R where
F: FnOnce(EnsureValidContext) -> R,
[src]
F: FnOnce(EnsureValidContext) -> R,
Ensures the current context is valid.
Panics
This function may panic if it's called while hexchat is closing.
pub fn get_context(&mut self) -> Context
[src]
Returns the current context.
Note: The returned context may be invalid. Use set_context
to check.
pub fn set_context(&mut self, ctx: &Context) -> bool
[src]
Sets the current context.
Returns true
if the context is valid, false
otherwise.
pub fn with_context<F, R>(
&mut self,
ctx: &Context,
f: F
) -> Result<R, InvalidContextError<F, R>> where
F: FnOnce(EnsureValidContext) -> R,
[src]
&mut self,
ctx: &Context,
f: F
) -> Result<R, InvalidContextError<F, R>> where
F: FnOnce(EnsureValidContext) -> R,
Do something in a valid context.
Note that this changes the active context and doesn't change it back.
Errors
Returns Err(InvalidContextError(f))
if the context is invalid. See set_context
. Otherwise,
calls f
and returns Ok(its result)
.
Note that InvalidContextError
contains the original closure. This allows you to retry.
pub fn hook_command<F>(
&mut self,
cmd: &str,
cb: F,
pri: i32,
help: Option<&str>
) -> CommandHookHandle where
F: Fn(&mut PluginHandle, Word, WordEol) -> Eat + 'static + RefUnwindSafe,
[src]
&mut self,
cmd: &str,
cb: F,
pri: i32,
help: Option<&str>
) -> CommandHookHandle where
F: Fn(&mut PluginHandle, Word, WordEol) -> Eat + 'static + RefUnwindSafe,
Sets a command hook
pub fn hook_server<F>(&mut self, cmd: &str, cb: F, pri: i32) -> ServerHookHandle where
F: Fn(&mut PluginHandle, Word, WordEol) -> Eat + 'static + RefUnwindSafe,
[src]
F: Fn(&mut PluginHandle, Word, WordEol) -> Eat + 'static + RefUnwindSafe,
Sets a server hook
pub fn hook_print<F>(&mut self, name: &str, cb: F, pri: i32) -> PrintHookHandle where
F: Fn(&mut PluginHandle, Word) -> Eat + 'static + RefUnwindSafe,
[src]
F: Fn(&mut PluginHandle, Word) -> Eat + 'static + RefUnwindSafe,
Sets a print hook
pub fn hook_timer<F>(&mut self, timeout: i32, cb: F) -> TimerHookHandle where
F: Fn(&mut PluginHandle) -> bool + 'static + RefUnwindSafe,
[src]
F: Fn(&mut PluginHandle) -> bool + 'static + RefUnwindSafe,
Sets a timer hook
pub fn print(&mut self, s: &str)
[src]
Prints to the hexchat buffer.
pub fn get_info(&mut self, id: &InfoId) -> Option<String>
[src]
Returns information on the current context.
Note: InfoId::Libdirfs
may return None
or broken results if the result wouldn't be (valid) UTF-8.