Struct libstrophe::Stanza
[−]
[src]
pub struct Stanza<'cx> { /* fields omitted */ }
Proxy to 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 pointersDrop
(xmpp_stanza_release)Clone
(xmpp_stanza_copy)Send
Methods
impl<'cx> Stanza<'cx>
[src]
pub fn new(ctx: &'cx Context) -> Stanza<'cx>
[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(ctx: &'cx Context) -> Stanza<'cx>
[src]
pub fn new_iq(
ctx: &'cx Context,
typ: Option<&str>,
id: Option<&str>
) -> Stanza<'cx>
[src]
ctx: &'cx Context,
typ: Option<&str>,
id: Option<&str>
) -> Stanza<'cx>
pub fn new_message(
ctx: &'cx Context,
typ: Option<&str>,
id: Option<&str>,
to: Option<&str>
) -> Stanza<'cx>
[src]
ctx: &'cx Context,
typ: Option<&str>,
id: Option<&str>,
to: Option<&str>
) -> Stanza<'cx>
pub unsafe fn from_inner(inner: *mut xmpp_stanza_t) -> Stanza<'cx>
[src]
Create an owning stanza from the raw pointer, for internal use
pub unsafe fn from_inner_ref(inner: *const xmpp_stanza_t) -> StanzaRef<'cx>
[src]
Create a borrowing stanza from the constant raw pointer, for internal use
pub unsafe fn from_inner_ref_mut(inner: *mut xmpp_stanza_t) -> StanzaMutRef<'cx>
[src]
Create a borrowing stanza from the mutable raw pointer, for internal use
pub fn as_inner(&self) -> *const xmpp_stanza_t
[src]
Return internal raw pointer to stanza, for internal use
pub fn context(&self) -> ContextRef<'cx>
[src]
Return context for this Stanza
The underlying library does not provide direct access to its context so this method works this around by relying on some of the library internals. With the new version this might need rewriting.
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<RefStr: AsRef<str>>(&mut self, name: RefStr) -> 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<RefStr1: AsRef<str>, RefStr2: AsRef<str>>(
&mut self,
name: RefStr1,
value: RefStr2
) -> EmptyResult
[src]
&mut self,
name: RefStr1,
value: RefStr2
) -> EmptyResult
pub fn get_attribute<RefStr: AsRef<str>>(&self, name: RefStr) -> Option<&str>
[src]
pub fn attributes(&self) -> HashMap<&str, &str>
[src]
This method returns data as HashMap
unlike underlying function.
pub fn del_attribute<RefStr: AsRef<str>>(&mut self, name: RefStr) -> EmptyResult
[src]
pub fn set_text<RefStr: AsRef<str>>(&mut self, text: RefStr) -> 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<RefStr: AsRef<str>>(&mut self, id: RefStr) -> EmptyResult
[src]
pub fn id(&self) -> Option<&str>
[src]
pub fn set_ns<RefStr: AsRef<str>>(&mut self, ns: RefStr) -> EmptyResult
[src]
pub fn ns(&self) -> Option<&str>
[src]
pub fn set_stanza_type<RefStr: AsRef<str>>(
&mut self,
typ: RefStr
) -> EmptyResult
[src]
&mut self,
typ: RefStr
) -> EmptyResult
pub fn stanza_type(&self) -> Option<&str>
[src]
pub fn set_to<RefStr: AsRef<str>>(&mut self, to: RefStr) -> EmptyResult
[src]
pub fn to(&self) -> Option<&str>
[src]
pub fn set_from<RefStr: AsRef<str>>(&mut self, from: RefStr) -> EmptyResult
[src]
pub fn from(&self) -> Option<&str>
[src]
pub fn get_first_child(&self) -> Option<StanzaRef>
[src]
pub fn get_first_child_mut(&self) -> Option<StanzaMutRef>
[src]
pub fn get_child_by_ns<RefStr: AsRef<str>>(
&self,
ns: RefStr
) -> Option<StanzaRef>
[src]
&self,
ns: RefStr
) -> Option<StanzaRef>
pub fn get_child_by_ns_mut<RefStr: AsRef<str>>(
&mut self,
ns: RefStr
) -> Option<StanzaMutRef>
[src]
&mut self,
ns: RefStr
) -> Option<StanzaMutRef>
pub fn get_child_by_name<RefStr: AsRef<str>>(
&self,
name: RefStr
) -> Option<StanzaRef>
[src]
&self,
name: RefStr
) -> Option<StanzaRef>
pub fn get_child_by_name_mut<RefStr: AsRef<str>>(
&mut self,
name: RefStr
) -> Option<StanzaMutRef>
[src]
&mut self,
name: RefStr
) -> Option<StanzaMutRef>
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) -> Stanza<'cx>
[src]
pub fn set_body<RefStr: AsRef<str>>(&mut self, body: RefStr) -> EmptyResult
[src]
pub fn body(&self) -> Option<String>
[src]
Trait Implementations
impl<'cx> Debug for Stanza<'cx>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<'cx> Hash for Stanza<'cx>
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<'cx> Display for Stanza<'cx>
[src]
impl<'cx> Clone for Stanza<'cx>
[src]
fn clone(&self) -> Self
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'cx> PartialEq for Stanza<'cx>
[src]
fn eq(&self, other: &Stanza) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<'cx> Eq for Stanza<'cx>
[src]
impl<'cx> Drop for Stanza<'cx>
[src]
impl<'cx> Send for Stanza<'cx>
[src]
impl<'cx> Into<StanzaRef<'cx>> for Stanza<'cx>
[src]
impl<'cx> Into<StanzaMutRef<'cx>> for Stanza<'cx>
[src]
fn into(self) -> StanzaMutRef<'cx>
[src]
Performs the conversion.