Struct libstrophe::Context

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

Proxy to the underlying 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(&self, timeout: Duration)

source

pub fn run(&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<Context<'_, '_>> for Context<'_, '_>

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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> !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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.