[][src]Struct tokio_xmpp::AsyncClient

pub struct AsyncClient { /* fields omitted */ }

XMPP client connection and state

It is able to reconnect. TODO: implement session management.

This implements the futures crate's Stream and Sink traits.

Implementations

impl Client[src]

pub fn new<P: Into<String>>(
    jid: &str,
    password: P
) -> Result<Self, JidParseError>
[src]

Start a new XMPP client

Start polling the returned instance so that it will connect and yield events.

pub fn new_with_config(config: Config) -> Self[src]

Start a new client given that the JID is already parsed.

pub fn set_reconnect(&mut self, reconnect: bool) -> &mut Self[src]

Set whether to reconnect (true) or let the stream end (false) when a connection to the server has ended.

pub fn bound_jid(&self) -> Option<&Jid>[src]

Get the client's bound JID (the one reported by the XMPP server).

pub async fn send_stanza(&mut self, stanza: Element) -> Result<(), Error>[src]

Send stanza

pub async fn send_end(&mut self) -> Result<(), Error>[src]

End connection by sending </stream:stream>

You may expect the server to respond with the same. This client will then drop its connection.

Make sure to disable reconnect.

Trait Implementations

impl Sink<Packet> for Client[src]

Outgoing XMPP packets

See send_stanza() for an async fn

type Error = Error

The type of value produced by the sink when an error occurs.

impl Stream for Client[src]

Incoming XMPP events

In an async fn you may want to use this with use futures::stream::StreamExt;

type Item = Event

Values yielded by the stream.

pub fn poll_next(
    mut self: Pin<&mut Self>,
    cx: &mut Context<'_>
) -> Poll<Option<Self::Item>>
[src]

Low-level read on the XMPP stream, allowing the underlying machinery to:

  • connect,
  • starttls,
  • authenticate,
  • bind a session, and finally
  • receive stanzas

...for your client

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, Item> SinkExt<Item> for T where
    T: Sink<Item> + ?Sized

impl<T> StreamExt for T where
    T: Stream + ?Sized

impl<St> StreamExt for St where
    St: Stream + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,