Struct Context

Source
pub struct Context<'cb, 'cn> { /* private fields */ }
Expand description

Proxy to the underlying sys::xmpp_ctx_t struct.

Most of the methods in this struct mimic the methods of the underlying library. So please see libstrophe docs for context and event loop plus ctx.c and event.c sources. Only where it’s not the case or there is some additional logic involved then you can see the method description.

This struct implements:

Implementations§

Source§

impl<'cb, 'cn> Context<'cb, 'cn>

Source

pub fn new(logger: Logger<'cb>) -> Self

Source

pub fn new_with_default_logger() -> Context<'static, 'cn>

Shortcut to return a new context with default logger.

Equivalent to passing default logger to Context constructor.

Source

pub fn new_with_null_logger() -> Context<'static, 'cn>

Shortcut to return a new context with null logger.

Equivalent to passing null logger to Context constructor.

Source

pub unsafe fn from_ref(inner: *const xmpp_ctx_t) -> Self

§Safety

inner must be a valid pointer to a previously allocated xmp_ctx_t, and you must make sure that Self doesn’t outlive the context behind that pointer

Source

pub unsafe fn from_ref_mut(inner: *mut xmpp_ctx_t) -> Self

§Safety

inner must be a valid pointer to a previously allocated mutable xmp_ctx_t, and you must make sure that Self doesn’t outlive the context behind that pointer

Source

pub fn set_timeout(&mut self, timeout: Duration)

xmpp_set_timeout

Default timeout is 1000ms

Source

pub fn run_once(&mut self, timeout: Duration)

Source

pub fn run(&mut self)

Source

pub fn stop(&self)

Source

pub fn log(&self, level: LogLevel, area: &str, msg: &str)

Trait Implementations§

Source§

impl<'cb, 'cn> Debug for Context<'cb, 'cn>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for Context<'_, '_>

Source§

impl PartialEq for Context<'_, '_>

Source§

fn eq(&self, other: &Context<'_, '_>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Context<'_, '_>

Source§

impl Send for Context<'_, '_>

Auto Trait Implementations§

§

impl<'cb, 'cn> Freeze for Context<'cb, 'cn>

§

impl<'cb, 'cn> !RefUnwindSafe for Context<'cb, 'cn>

§

impl<'cb, 'cn> !Sync for Context<'cb, 'cn>

§

impl<'cb, 'cn> Unpin for Context<'cb, 'cn>

§

impl<'cb, 'cn> !UnwindSafe for Context<'cb, 'cn>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.