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§
Source§impl<'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<'b, I: IntoIterator<Item = &'b str>>( self, event: &str, args: I, ) -> bool
pub fn emit_print_attrs<'b, I: IntoIterator<Item = &'b str>>( self, attrs: EventAttrs<'_>, event: &str, args: I, ) -> bool
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>,
) -> CommandHookHandle
pub fn hook_command<F>( &mut self, cmd: &str, cb: F, pri: i32, help: Option<&str>, ) -> CommandHookHandle
Sets a command hook
Sourcepub fn hook_server<F>(&mut self, cmd: &str, cb: F, pri: i32) -> ServerHookHandle
pub fn hook_server<F>(&mut self, cmd: &str, cb: F, pri: i32) -> ServerHookHandle
Sets a server hook
Sourcepub fn hook_print<F>(&mut self, name: &str, cb: F, pri: i32) -> PrintHookHandle
pub fn hook_print<F>(&mut self, name: &str, cb: F, pri: i32) -> PrintHookHandle
Sets a print hook
Sourcepub fn hook_timer<F>(&mut self, timeout: i32, cb: F) -> TimerHookHandle
pub fn hook_timer<F>(&mut self, timeout: i32, cb: F) -> TimerHookHandle
Sets a timer hook
pub fn get_info(&mut self, id: &InfoId<'_>) -> Option<String>
Auto Trait Implementations§
impl<'a> Freeze for EnsureValidContext<'a>
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§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more