diff --git a/tokio-xmpp/ChangeLog b/tokio-xmpp/ChangeLog index 11ebd407..740695e7 100644 --- a/tokio-xmpp/ChangeLog +++ b/tokio-xmpp/ChangeLog @@ -25,6 +25,7 @@ Version NEXT: - Update hickory-dns to 0.26 (!671) - Drive the XMPP client stream in the background (!631) - Add option to split XMPP client into read and write half (!631) + - Remove T: AsXml bound from XmlStream (!675) Version 5.0.0: 2025-10-28 pep diff --git a/tokio-xmpp/src/xmlstream/initiator.rs b/tokio-xmpp/src/xmlstream/initiator.rs index e0698d8a..24f87903 100644 --- a/tokio-xmpp/src/xmlstream/initiator.rs +++ b/tokio-xmpp/src/xmlstream/initiator.rs @@ -18,7 +18,7 @@ use xmpp_parsers::{ stream_features::StreamFeatures, }; -use xso::{AsXml, FromXml}; +use xso::FromXml; use super::{ common::{RawXmlStream, ReadXso, ReadXsoError, StreamHeader}, @@ -127,7 +127,7 @@ impl PendingFeaturesRecv { /// If the peer sends any payload which is neither stream features nor /// a stream error, an [`io::Error`][`std::io::Error`] with /// [`InvalidData`][`io::ErrorKind::InvalidData`] kind is returned. - pub async fn recv_features( + pub async fn recv_features( self, ) -> Result<(StreamFeatures, XmlStream), RecvFeaturesError> { let Self { @@ -170,7 +170,7 @@ impl PendingFeaturesRecv { /// down the road (because the feature stream element cannot be handled). /// The only place where this is useful is in /// [XEP-0114](https://xmpp.org/extensions/xep-0114.html) connections. - pub fn skip_features(self) -> XmlStream { + pub fn skip_features(self) -> XmlStream { XmlStream::wrap(self.stream) } } diff --git a/tokio-xmpp/src/xmlstream/mod.rs b/tokio-xmpp/src/xmlstream/mod.rs index c5d219bd..828fe6e2 100644 --- a/tokio-xmpp/src/xmlstream/mod.rs +++ b/tokio-xmpp/src/xmlstream/mod.rs @@ -259,7 +259,7 @@ impl XmlStream { } } -impl XmlStream { +impl XmlStream { fn wrap(inner: RawXmlStream) -> Self { Self { inner, @@ -281,7 +281,7 @@ impl XmlStream { } } -impl XmlStream { +impl XmlStream { /// Initiate a stream reset /// /// To actually send the stream header, call @@ -329,7 +329,7 @@ impl Xml /// /// 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. - pub async fn accept_reset(mut self, barrier: &T) -> io::Result> { + pub async fn accept_reset(mut self, barrier: &U) -> io::Result> { self.assert_retypable(); self.send(barrier).await?; @@ -361,7 +361,7 @@ impl Xml } } -impl Stream for XmlStream { +impl Stream for XmlStream { type Item = Result; fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { @@ -401,7 +401,7 @@ impl Stream for XmlStream XmlStream { +impl XmlStream { /// Initiate stream shutdown and poll for completion. /// /// Please see [`Self::shutdown`] for details. @@ -443,7 +443,7 @@ impl XmlStream { } } -impl XmlStream { +impl XmlStream { /// Send the stream footer and close the sender side of the underlying /// transport. /// @@ -459,7 +459,7 @@ impl XmlStream { } } -impl<'x, Io: AsyncWrite, T: FromXml + AsXml, U: AsXml> Sink<&'x U> for XmlStream { +impl<'x, Io: AsyncWrite, T: FromXml, U: AsXml> Sink<&'x U> for XmlStream { type Error = io::Error; fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { @@ -489,11 +489,11 @@ impl<'x, Io: AsyncWrite, T: FromXml + AsXml, U: AsXml> Sink<&'x U> for XmlStream /// Future implementing [`XmlStream::shutdown`] using /// [`XmlStream::poll_shutdown`]. -pub struct Shutdown<'a, Io: AsyncWrite, T: FromXml + AsXml> { +pub struct Shutdown<'a, Io: AsyncWrite, T: FromXml> { stream: Pin<&'a mut XmlStream>, } -impl Future for Shutdown<'_, Io, T> { +impl Future for Shutdown<'_, Io, T> { type Output = io::Result<()>; fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll { diff --git a/tokio-xmpp/src/xmlstream/responder.rs b/tokio-xmpp/src/xmlstream/responder.rs index 20c65eea..326d5cd2 100644 --- a/tokio-xmpp/src/xmlstream/responder.rs +++ b/tokio-xmpp/src/xmlstream/responder.rs @@ -14,7 +14,7 @@ use tokio::io::{AsyncBufRead, AsyncWrite}; use xmpp_parsers::{stream_error::StreamError, stream_features::StreamFeatures}; -use xso::{AsXml, FromXml}; +use xso::FromXml; use super::{ common::{RawXmlStream, StreamHeader}, @@ -78,7 +78,7 @@ impl PendingFeaturesSend { /// After the stream features have been sent, the stream can be used for /// exchanging stream-level elements (stanzas or "nonzas"). The Rust type /// for these elements must be given as type parameter `T`. - pub async fn send_features( + pub async fn send_features( self, features: &'_ StreamFeatures, ) -> io::Result> {