pub type XmppStream = XmlStream<Box<dyn AsyncReadAndWrite + Send + 'static>, XmppStreamElement>;
Expand description
Convenience alias for XmlStreams
which
may be used with StanzaStream
.
Aliased Type§
struct XmppStream { /* private fields */ }
Implementations
Source§impl<Io, T: FromXml> XmlStream<Io, T>
impl<Io, T: FromXml> XmlStream<Io, T>
Sourcepub fn get_stream(&self) -> &Io
pub fn get_stream(&self) -> &Io
Obtain a reference to the Io
stream.
Source§impl<Io: AsyncBufRead + AsyncWrite + Unpin, T: FromXml + AsXml + Debug> XmlStream<Io, T>
impl<Io: AsyncBufRead + AsyncWrite + Unpin, T: FromXml + AsXml + Debug> XmlStream<Io, T>
Sourcepub fn initiate_reset(self) -> InitiatingStream<Io>
pub fn initiate_reset(self) -> InitiatingStream<Io>
Initiate a stream reset
To actually send the stream header, call
send_header
on the result.
§Panics
Attempting to reset the stream while an object is being received will
panic. This can generally only happen if you call poll_next
directly, as doing that is otherwise prevented by the borrowchecker.
In addition, attempting to reset a stream which has been closed by either side or which has had an I/O error will also cause a panic.
Sourcepub async fn accept_reset(self, barrier: &T) -> Result<AcceptedStream<Io>>
pub async fn accept_reset(self, barrier: &T) -> Result<AcceptedStream<Io>>
Trigger a stream reset on the initiator side and await the new stream header.
This is the responder-side counterpart to
initiate_reset
. The element which causes
the stream reset must be passed as barrier
and it will be sent
right before resetting the parser state. This way, the race condition
outlined in the xmlstream
module’s documentation is
guaranteed to be avoided.
Note that you should not send the element passed as barrier
down the
stream yourself, as this function takes care of it.
§Stream resets without a triggering element
These are not possible to do safely and not specified in RFC 6120,
hence they cannot be done in XmlStream
.
§Panics
Attempting to reset the stream while an object is being received will
panic. This can generally only happen if you call poll_next
directly, as doing that is otherwise prevented by the borrowchecker.
In addition, attempting to reset a stream which has been closed by either side or which has had an I/O error will also cause a panic.
Sourcepub fn into_inner(self) -> Io
pub fn into_inner(self) -> Io
Discard all XML state and return the inner I/O object.
Sourcepub fn box_stream(
self,
) -> XmlStream<Box<dyn AsyncReadAndWrite + Send + 'static>, T>where
Io: AsyncReadAndWrite + Send + 'static,
pub fn box_stream(
self,
) -> XmlStream<Box<dyn AsyncReadAndWrite + Send + 'static>, T>where
Io: AsyncReadAndWrite + Send + 'static,
Box the underlying transport stream.
This removes the specific type of the transport from the XML stream’s type signature.
Source§impl<Io: AsyncWrite, T: FromXml + AsXml> XmlStream<Io, T>
impl<Io: AsyncWrite, T: FromXml + AsXml> XmlStream<Io, T>
Sourcepub fn poll_shutdown(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), Error>>
pub fn poll_shutdown( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Error>>
Initiate stream shutdown and poll for completion.
Please see Self::shutdown
for details.
Source§impl<Io: AsyncWrite + Unpin, T: FromXml + AsXml> XmlStream<Io, T>
impl<Io: AsyncWrite + Unpin, T: FromXml + AsXml> XmlStream<Io, T>
Sourcepub fn shutdown(&mut self) -> Shutdown<'_, Io, T> ⓘ
pub fn shutdown(&mut self) -> Shutdown<'_, Io, T> ⓘ
Send the stream footer and close the sender side of the underlying transport.
Unlike poll_close
(from the Sink
impls), this will not close the
receiving side of the underlying the transport. It is advisable to call
poll_close
eventually after poll_shutdown
in order to gracefully
handle situations where the remote side does not close the stream
cleanly.
Trait Implementations
Source§impl<'x, Io: AsyncWrite, T: FromXml + AsXml, U: AsXml> Sink<&'x U> for XmlStream<Io, T>
impl<'x, Io: AsyncWrite, T: FromXml + AsXml, U: AsXml> Sink<&'x U> for XmlStream<Io, T>
Source§fn poll_ready(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>
fn poll_ready( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
Sink
to receive a value. Read more