Struct libstrophe::StanzaRef

source ·
pub struct StanzaRef<'st>(_, _);
Expand description

Wrapper for constant reference to Stanza, implements Deref to Stanza

You can obtain such objects by calling Stanza child search methods.

Methods from Deref<Target = Stanza>§

source

pub fn is_text(&self) -> bool

source

pub fn is_tag(&self) -> bool

source

pub fn to_text(&self) -> Result<String, ToTextError>

source

pub fn name(&self) -> Option<&str>

source

pub fn attribute_count(&self) -> i32

source

pub fn get_attribute(&self, name: impl AsRef<str>) -> Option<&str>

source

pub fn attributes(&self) -> HashMap<&str, &str>

xmpp_stanza_get_attributes

This method returns data as HashMap unlike underlying function.

source

pub fn text(&self) -> Option<String>

source

pub fn id(&self) -> Option<&str>

source

pub fn ns(&self) -> Option<&str>

source

pub fn stanza_type(&self) -> Option<&str>

source

pub fn to(&self) -> Option<&str>

source

pub fn from(&self) -> Option<&str>

source

pub fn get_first_child(&self) -> Option<StanzaRef<'_>>

source

pub fn get_child_by_ns(&self, ns: impl AsRef<str>) -> Option<StanzaRef<'_>>

source

pub fn get_child_by_name(&self, name: impl AsRef<str>) -> Option<StanzaRef<'_>>

source

pub fn get_child_by_name_and_ns( &self, name: impl AsRef<str>, ns: impl AsRef<str> ) -> Option<StanzaRef<'_>>

source

pub fn get_child_by_path(&self, path: &[&str]) -> Option<StanzaRef<'_>>

xmpp_stanza_get_child_by_path

Due to internal limitations (vararg call in C) this function supports a maximum of 10 elements in the path slice.

source

pub fn children(&self) -> impl Iterator<Item = StanzaRef<'_>>

source

pub fn get_next(&self) -> Option<StanzaRef<'_>>

source

pub fn reply(&self) -> Self

source

pub fn reply_error( &self, error_type: impl AsRef<str>, condition: impl AsRef<str>, text: impl AsRef<str> ) -> Self

source

pub fn body(&self) -> Option<String>

Trait Implementations§

source§

impl<'st> Debug for StanzaRef<'st>

source§

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

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

impl Deref for StanzaRef<'_>

§

type Target = Stanza

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl Display for StanzaRef<'_>

source§

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

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

impl<'st> From<Stanza> for StanzaRef<'st>

source§

fn from(s: Stanza) -> Self

Converts to this type from the input type.
source§

impl PartialEq<StanzaRef<'_>> for StanzaRef<'_>

source§

fn eq(&self, other: &StanzaRef<'_>) -> 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<'st> Eq for StanzaRef<'st>

source§

impl<'st> StructuralEq for StanzaRef<'st>

Auto Trait Implementations§

§

impl<'st> RefUnwindSafe for StanzaRef<'st>

§

impl<'st> !Send for StanzaRef<'st>

§

impl<'st> !Sync for StanzaRef<'st>

§

impl<'st> Unpin for StanzaRef<'st>

§

impl<'st> UnwindSafe for StanzaRef<'st>

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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
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.