[−][src]Struct libstrophe::Stanza
Proxy to the underlying xmpp_stanza_t
struct.
Most of the methods in this struct mimic the methods of the underlying library. So please see libstrophe docs and 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:
Display
(xmpp_stanza_to_text)Eq
by comparing internal pointersHash
by hashing internal pointerDrop
(xmpp_stanza_release)Clone
(xmpp_stanza_copy)Send
Methods
impl Stanza
[src]
pub fn new() -> Self
[src]
The newly created stanza is not really useful until you assign an internal type to it. To do
that you must call set_text()
to make it XMPP_STANZA_TEXT
stanza or set_name()
to make
it XMPP_STANZA_TAG
stanza.
pub fn new_presence() -> Self
[src]
pub fn new_iq(typ: Option<&str>, id: Option<&str>) -> Self
[src]
pub fn new_message(
typ: Option<&str>,
id: Option<&str>,
to: Option<&str>
) -> Self
[src]
typ: Option<&str>,
id: Option<&str>,
to: Option<&str>
) -> Self
pub unsafe fn from_inner(inner: *mut xmpp_stanza_t) -> Self
[src]
Create an owning stanza from the raw pointer, for internal use
pub unsafe fn from_inner_ref<'st>(inner: *const xmpp_stanza_t) -> StanzaRef<'st>
[src]
Create a borrowing stanza from the constant raw pointer, for internal use
pub unsafe fn from_inner_ref_mut<'st>(
inner: *mut xmpp_stanza_t
) -> StanzaMutRef<'st>
[src]
inner: *mut xmpp_stanza_t
) -> StanzaMutRef<'st>
Create a borrowing stanza from the mutable raw pointer, for internal use
pub fn as_inner(&self) -> *mut xmpp_stanza_t
[src]
Return internal raw pointer to stanza, for internal use
pub fn is_text(&self) -> bool
[src]
pub fn is_tag(&self) -> bool
[src]
pub fn to_text(&self) -> Result<String>
[src]
pub fn set_name(&mut self, name: impl AsRef<str>) -> EmptyResult
[src]
Be aware that calling this method changes the internal type of stanza to XMPP_STANZA_TAG
.
pub fn name(&self) -> Option<&str>
[src]
pub fn attribute_count(&self) -> i32
[src]
pub fn set_attribute(
&mut self,
name: impl AsRef<str>,
value: impl AsRef<str>
) -> EmptyResult
[src]
&mut self,
name: impl AsRef<str>,
value: impl AsRef<str>
) -> EmptyResult
pub fn get_attribute(&self, name: impl AsRef<str>) -> Option<&str>
[src]
pub fn attributes(&self) -> HashMap<&str, &str>
[src]
This method returns data as HashMap
unlike underlying function.
pub fn del_attribute(&mut self, name: impl AsRef<str>) -> EmptyResult
[src]
pub fn set_text(&mut self, text: impl AsRef<str>) -> EmptyResult
[src]
xmpp_stanza_set_text_with_size
Be aware that calling this method changes the internal type of stanza to XMPP_STANZA_TEXT
.
pub fn text(&self) -> Option<String>
[src]
pub fn set_id(&mut self, id: impl AsRef<str>) -> EmptyResult
[src]
pub fn id(&self) -> Option<&str>
[src]
pub fn set_ns(&mut self, ns: impl AsRef<str>) -> EmptyResult
[src]
pub fn ns(&self) -> Option<&str>
[src]
pub fn set_stanza_type(&mut self, typ: impl AsRef<str>) -> EmptyResult
[src]
pub fn stanza_type(&self) -> Option<&str>
[src]
pub fn set_to(&mut self, to: impl AsRef<str>) -> EmptyResult
[src]
pub fn to(&self) -> Option<&str>
[src]
pub fn set_from(&mut self, from: impl AsRef<str>) -> EmptyResult
[src]
pub fn from(&self) -> Option<&str>
[src]
pub fn get_first_child(&self) -> Option<StanzaRef>
[src]
pub fn get_first_child_mut(&mut self) -> Option<StanzaMutRef>
[src]
pub fn get_child_by_ns(&self, ns: impl AsRef<str>) -> Option<StanzaRef>
[src]
pub fn get_child_by_ns_mut(
&mut self,
ns: impl AsRef<str>
) -> Option<StanzaMutRef>
[src]
&mut self,
ns: impl AsRef<str>
) -> Option<StanzaMutRef>
pub fn get_child_by_name(&self, name: impl AsRef<str>) -> Option<StanzaRef>
[src]
pub fn get_child_by_name_mut(
&mut self,
name: impl AsRef<str>
) -> Option<StanzaMutRef>
[src]
&mut self,
name: impl AsRef<str>
) -> Option<StanzaMutRef>
pub fn children(&self) -> impl Iterator<Item = StanzaRef>
[src]
pub fn children_mut(&mut self) -> impl Iterator<Item = StanzaMutRef>
[src]
pub fn get_next(&self) -> Option<StanzaRef>
[src]
pub fn get_next_mut(&mut self) -> Option<StanzaMutRef>
[src]
pub fn add_child(&mut self, child: Stanza) -> EmptyResult
[src]
pub fn reply(&self) -> Self
[src]
pub fn set_body(&mut self, body: impl AsRef<str>) -> EmptyResult
[src]
pub fn body(&self) -> Option<String>
[src]
Trait Implementations
impl Drop for Stanza
[src]
impl PartialEq<Stanza> for Stanza
[src]
fn eq(&self, other: &Stanza) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Default for Stanza
[src]
impl Clone for Stanza
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Eq for Stanza
[src]
impl<'st> Into<StanzaRef<'st>> for Stanza
[src]
impl<'st> Into<StanzaMutRef<'st>> for Stanza
[src]
fn into(self) -> StanzaMutRef<'st>
[src]
impl Send for Stanza
[src]
impl Display for Stanza
[src]
impl Debug for Stanza
[src]
impl Hash for Stanza
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,