aboutsummaryrefslogtreecommitdiffstats
path: root/src/reader.rs
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@bunny.garden>2024-11-29 02:10:19 +0000
committerLibravatar cel 🌸 <cel@bunny.garden>2024-11-29 02:10:19 +0000
commit2dae043e8ffcb030699f3523568544676e370b53 (patch)
tree52669190c01bd5d7da03d1c9181d00eb23a21124 /src/reader.rs
parentaa940a8eac74aca8cd3c202a05092538d1140dda (diff)
downloadpeanuts-2dae043e8ffcb030699f3523568544676e370b53.tar.gz
peanuts-2dae043e8ffcb030699f3523568544676e370b53.tar.bz2
peanuts-2dae043e8ffcb030699f3523568544676e370b53.zip
add some tracing
Diffstat (limited to 'src/reader.rs')
-rw-r--r--src/reader.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/reader.rs b/src/reader.rs
index aa4d467..d2de170 100644
--- a/src/reader.rs
+++ b/src/reader.rs
@@ -9,6 +9,7 @@ use std::{
str::{self, FromStr},
};
use tokio::io::{AsyncBufRead, AsyncBufReadExt, AsyncRead, AsyncReadExt};
+use tracing::debug;
use crate::{
declaration::{Declaration, VersionInfo},
@@ -21,6 +22,7 @@ use crate::{
static MAX_STANZA_SIZE: usize = 65536;
/// streaming reader that tracks depth and available namespaces at current depth
+#[derive(Debug)]
pub struct Reader<R> {
inner: R,
pub buffer: Buffer,
@@ -59,7 +61,7 @@ impl<R> Reader<R>
where
R: AsyncRead + Unpin,
{
- async fn read_buf<'s>(&mut self) -> Result<usize> {
+ pub async fn read_buf<'s>(&mut self) -> Result<usize> {
Ok(self.inner.read_buf(&mut self.buffer).await?)
}
@@ -107,6 +109,7 @@ where
pub async fn read<'s, T: FromElement>(&'s mut self) -> Result<T> {
let element = self.read_element().await?;
+ debug!("read element: {:?}", element);
Ok(FromElement::from_element(element)?)
}