xmlstream: add access to inner stream

This commit is contained in:
Jonas Schäfer 2024-08-10 12:44:25 +02:00
parent 2931df22db
commit 2c944ebbf8
2 changed files with 11 additions and 0 deletions

View file

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

View file

@ -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> { impl<Io: AsyncBufRead, T: FromXml + AsXml> XmlStream<Io, T> {
fn wrap(inner: RawXmlStream<Io>) -> Self { fn wrap(inner: RawXmlStream<Io>) -> Self {
Self { Self {