From 2c944ebbf832f322183044eff2fd6eaa556bae56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sch=C3=A4fer?= Date: Sat, 10 Aug 2024 12:44:25 +0200 Subject: [PATCH] xmlstream: add access to inner stream --- tokio-xmpp/src/xmlstream/common.rs | 4 ++++ tokio-xmpp/src/xmlstream/mod.rs | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/tokio-xmpp/src/xmlstream/common.rs b/tokio-xmpp/src/xmlstream/common.rs index a30286b3..c560ab37 100644 --- a/tokio-xmpp/src/xmlstream/common.rs +++ b/tokio-xmpp/src/xmlstream/common.rs @@ -133,6 +133,10 @@ impl RawXmlStream { 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 Stream for RawXmlStream { diff --git a/tokio-xmpp/src/xmlstream/mod.rs b/tokio-xmpp/src/xmlstream/mod.rs index b14915ce..9a005ed2 100644 --- a/tokio-xmpp/src/xmlstream/mod.rs +++ b/tokio-xmpp/src/xmlstream/mod.rs @@ -161,6 +161,13 @@ pin_project_lite::pin_project! { } } +impl XmlStream { + /// Obtain a reference to the `Io` stream. + pub fn get_stream(&self) -> &Io { + self.inner.get_stream() + } +} + impl XmlStream { fn wrap(inner: RawXmlStream) -> Self { Self {