pub enum Iq {
Get {
from: Option<Jid>,
to: Option<Jid>,
id: String,
payload: Element,
},
Set {
from: Option<Jid>,
to: Option<Jid>,
id: String,
payload: Element,
},
Result {
from: Option<Jid>,
to: Option<Jid>,
id: String,
payload: Option<Element>,
},
Error {
from: Option<Jid>,
to: Option<Jid>,
id: String,
error: StanzaError,
payload: Option<Element>,
},
}Expand description
The main structure representing the <iq/> stanza.
Variants§
Get
An <iq type='get'/> stanza.
Fields
Set
An <iq type='set'/> stanza.
Fields
Result
An <iq type='result'/> stanza.
Fields
Error
An <iq type='error'/> stanza.
Fields
id: StringThe @id attribute of this stanza, which is required in order to match a request with its result/error.
error: StanzaErrorThe error carried by this stanza.
payload: Option<Element>The optional payload content which caused the error.
As per RFC 6120 § 8.3.1, the emitter of an error stanza MAY include the original XML which caused the error. However, recipients MUST NOT rely on this.
Implementations§
Source§impl Iq
impl Iq
Sourcepub fn from_get<S: Into<String>>(id: S, payload: impl IqGetPayload) -> Iq
pub fn from_get<S: Into<String>>(id: S, payload: impl IqGetPayload) -> Iq
Creates an <iq/> stanza containing a get request.
Sourcepub fn from_set<S: Into<String>>(id: S, payload: impl IqSetPayload) -> Iq
pub fn from_set<S: Into<String>>(id: S, payload: impl IqSetPayload) -> Iq
Creates an <iq/> stanza containing a set request.
Sourcepub fn empty_result<S: Into<String>>(to: Jid, id: S) -> Iq
pub fn empty_result<S: Into<String>>(to: Jid, id: S) -> Iq
Creates an empty <iq type="result"/> stanza.
Sourcepub fn from_result<S: Into<String>>(
id: S,
payload: Option<impl IqResultPayload>,
) -> Iq
pub fn from_result<S: Into<String>>( id: S, payload: Option<impl IqResultPayload>, ) -> Iq
Creates an <iq/> stanza containing a result.
Sourcepub fn from_error<S: Into<String>>(id: S, payload: StanzaError) -> Iq
pub fn from_error<S: Into<String>>(id: S, payload: StanzaError) -> Iq
Creates an <iq/> stanza containing an error.
Sourcepub fn with_id(self, id: String) -> Iq
pub fn with_id(self, id: String) -> Iq
Sets the id of this stanza, in order to later match its response.
Sourcepub fn into_header(self) -> IqHeader
pub fn into_header(self) -> IqHeader
Return the IqHeader of this stanza, discarding the payload.
Trait Implementations§
Source§impl AsXml for Iq
impl AsXml for Iq
Source§impl FromXml for Iq
impl FromXml for Iq
Source§fn from_events(
name: QName,
attrs: AttrMap,
ctx: &Context<'_>,
) -> Result<Self::Builder, FromEventsError>
fn from_events( name: QName, attrs: AttrMap, ctx: &Context<'_>, ) -> Result<Self::Builder, FromEventsError>
Source§fn xml_name_matcher() -> XmlNameMatcher<'static>
fn xml_name_matcher() -> XmlNameMatcher<'static>
Self may be parsed from
a given XML element. Read more