Struct hexchat_plugin::EnsureValidContext
source · pub struct EnsureValidContext<'a> { /* private fields */ }
Expand description
A safety wrapper to ensure you’re working with a valid context.
This mechanism attempts to reduce the likelihood of segfaults.
Implementations
sourceimpl<'a> EnsureValidContext<'a>
impl<'a> EnsureValidContext<'a>
sourcepub fn find_context(
&mut self,
servname: Option<&str>,
channel: Option<&str>
) -> Option<Context>
pub fn find_context(
&mut self,
servname: Option<&str>,
channel: Option<&str>
) -> Option<Context>
Finds an open context for the given servname and channel.
sourcepub fn nickcmp(&mut self, nick1: &str, nick2: &str) -> Ordering
pub fn nickcmp(&mut self, nick1: &str, nick2: &str) -> Ordering
Compares two nicks based on the server’s case mapping.
pub fn send_modes<'b, I: IntoIterator<Item = &'b str>>(
&mut self,
iter: I,
mpl: i32,
sign: char,
mode: char
)
pub fn emit_print(self)
pub fn emit_print_attrs(self)
pub fn get_context(&mut self) -> Context
sourcepub fn set_context(&mut self, ctx: &Context) -> bool
pub fn set_context(&mut self, ctx: &Context) -> bool
Sets the current context.
Returns true
if the context is valid, false
otherwise.
sourcepub fn hook_command<F>(
&mut self,
cmd: &str,
cb: F,
pri: i32,
help: Option<&str>
) -> CommandHookHandlewhere
F: Fn(&mut PluginHandle, Word<'_>, WordEol<'_>) -> Eat + 'static + RefUnwindSafe,
pub fn hook_command<F>(
&mut self,
cmd: &str,
cb: F,
pri: i32,
help: Option<&str>
) -> CommandHookHandlewhere
F: Fn(&mut PluginHandle, Word<'_>, WordEol<'_>) -> Eat + 'static + RefUnwindSafe,
Sets a command hook
sourcepub fn hook_server<F>(&mut self, cmd: &str, cb: F, pri: i32) -> ServerHookHandlewhere
F: Fn(&mut PluginHandle, Word<'_>, WordEol<'_>) -> Eat + 'static + RefUnwindSafe,
pub fn hook_server<F>(&mut self, cmd: &str, cb: F, pri: i32) -> ServerHookHandlewhere
F: Fn(&mut PluginHandle, Word<'_>, WordEol<'_>) -> Eat + 'static + RefUnwindSafe,
Sets a server hook
sourcepub fn hook_print<F>(&mut self, name: &str, cb: F, pri: i32) -> PrintHookHandlewhere
F: Fn(&mut PluginHandle, Word<'_>) -> Eat + 'static + RefUnwindSafe,
pub fn hook_print<F>(&mut self, name: &str, cb: F, pri: i32) -> PrintHookHandlewhere
F: Fn(&mut PluginHandle, Word<'_>) -> Eat + 'static + RefUnwindSafe,
Sets a print hook
sourcepub fn hook_timer<F>(&mut self, timeout: i32, cb: F) -> TimerHookHandlewhere
F: Fn(&mut PluginHandle) -> bool + 'static + RefUnwindSafe,
pub fn hook_timer<F>(&mut self, timeout: i32, cb: F) -> TimerHookHandlewhere
F: Fn(&mut PluginHandle) -> bool + 'static + RefUnwindSafe,
Sets a timer hook
pub fn get_info(&mut self, id: &InfoId<'_>) -> Option<String>
Auto Trait Implementations
impl<'a> RefUnwindSafe for EnsureValidContext<'a>
impl<'a> !Send for EnsureValidContext<'a>
impl<'a> !Sync for EnsureValidContext<'a>
impl<'a> Unpin for EnsureValidContext<'a>
impl<'a> !UnwindSafe for EnsureValidContext<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more