xmlstream: add access to inner stream

Jonas Schäfer created

Change summary

tokio-xmpp/src/xmlstream/common.rs | 4 ++++
tokio-xmpp/src/xmlstream/mod.rs    | 7 +++++++
2 files changed, 11 insertions(+)

Detailed changes

tokio-xmpp/src/xmlstream/common.rs 🔗

@@ -133,6 +133,10 @@ impl<Io> RawXmlStream<Io> {
     fn parser_pinned(self: Pin<&mut Self>) -> &mut rxml::Parser {
         self.project().parser.parser_pinned()
     }
+
+    pub(super) fn get_stream(&self) -> &Io {
+        self.parser.inner()
+    }
 }
 
 impl<Io: AsyncBufRead> Stream for RawXmlStream<Io> {

tokio-xmpp/src/xmlstream/mod.rs 🔗

@@ -161,6 +161,13 @@ pin_project_lite::pin_project! {
     }
 }
 
+impl<Io, T: FromXml> XmlStream<Io, T> {
+    /// Obtain a reference to the `Io` stream.
+    pub fn get_stream(&self) -> &Io {
+        self.inner.get_stream()
+    }
+}
+
 impl<Io: AsyncBufRead, T: FromXml + AsXml> XmlStream<Io, T> {
     fn wrap(inner: RawXmlStream<Io>) -> Self {
         Self {