aboutsummaryrefslogtreecommitdiffstats
path: root/src/reader.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/reader.rs')
-rw-r--r--src/reader.rs20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/reader.rs b/src/reader.rs
index 8387373..f1f3744 100644
--- a/src/reader.rs
+++ b/src/reader.rs
@@ -48,7 +48,7 @@ where
Ok(self.inner.read_buf(&mut self.buffer).await?)
}
- async fn read_prolog<'s>(&'s mut self) -> Result<()> {
+ pub async fn read_prolog<'s>(&'s mut self) -> Result<()> {
loop {
self.read_buf().await?;
let input = str::from_utf8(self.buffer.data())?;
@@ -68,7 +68,7 @@ where
}
}
- async fn read_start_tag<'s>(&'s mut self) -> Result<Element> {
+ pub async fn read_start_tag<'s>(&'s mut self) -> Result<Element> {
loop {
self.read_buf().await?;
let input = str::from_utf8(self.buffer.data())?;
@@ -93,7 +93,7 @@ where
}
}
- async fn read_end_tag<'s>(&'s mut self) -> Result<()> {
+ pub async fn read_end_tag<'s>(&'s mut self) -> Result<()> {
loop {
self.read_buf().await?;
let input = str::from_utf8(self.buffer.data())?;
@@ -118,7 +118,7 @@ where
}
}
- async fn read_element<'s>(&'s mut self) -> Result<Element> {
+ pub async fn read_element<'s>(&'s mut self) -> Result<Element> {
loop {
self.read_buf().await?;
let input = str::from_utf8(self.buffer.data())?;
@@ -140,7 +140,7 @@ where
}
}
- async fn read_content<'s>(&'s mut self) -> Result<Content> {
+ pub async fn read_content<'s>(&'s mut self) -> Result<Content> {
let mut last_char = false;
let mut text = String::new();
loop {
@@ -674,19 +674,21 @@ impl<R: AsyncRead + Unpin> Stream for Reader<R> {
}
#[cfg(test)]
-mod test {
+pub(crate) mod test {
use futures::{sink::Buffer, StreamExt};
use tokio::io::AsyncRead;
+ use crate::element::Element;
+
use super::Reader;
- struct MockAsyncReader<'s> {
+ pub struct MockAsyncReader<'s> {
put: bool,
data: &'s str,
}
impl<'s> MockAsyncReader<'s> {
- fn new(data: &'s str) -> Self {
+ pub fn new(data: &'s str) -> Self {
Self { put: false, data }
}
}
@@ -705,7 +707,7 @@ mod test {
}
}
- const TEST_DOC: &'static str = "<xs:schema
+ pub const TEST_DOC: &'static str = "<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace='http://etherx.jabber.org/streams'
xmlns='http://etherx.jabber.org/streams'