aboutsummaryrefslogtreecommitdiffstats
path: root/src/reader.rs
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@blos.sm>2024-03-04 16:14:28 +0000
committerLibravatar cel 🌸 <cel@blos.sm>2024-03-04 16:14:28 +0000
commit844f3a5d11e4360e9d6bdb79cfed49287aa8b14d (patch)
tree5525c4f134ef3d7a6082935baa61e6097670c968 /src/reader.rs
downloadpeanuts-844f3a5d11e4360e9d6bdb79cfed49287aa8b14d.tar.gz
peanuts-844f3a5d11e4360e9d6bdb79cfed49287aa8b14d.tar.bz2
peanuts-844f3a5d11e4360e9d6bdb79cfed49287aa8b14d.zip
initial commit
Diffstat (limited to 'src/reader.rs')
-rw-r--r--src/reader.rs32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/reader.rs b/src/reader.rs
new file mode 100644
index 0000000..05afc73
--- /dev/null
+++ b/src/reader.rs
@@ -0,0 +1,32 @@
+use futures::Stream;
+use tokio::io::AsyncRead;
+
+use crate::{
+ element::{Element, Name, Namespace},
+ error::Error,
+};
+
+/// streaming reader that tracks depth and available namespaces at current depth
+pub struct Reader<R> {
+ stream: R,
+ // holds which tags we are in atm over depth
+ depth: Vec<Name>,
+ namespaces: Vec<(usize, Namespace)>,
+}
+
+impl<R: AsyncRead> Reader<R> {
+ pub async fn read(&self) -> Result<impl From<Element>, Error> {}
+ pub async fn read_start(&self) -> Result<impl From<Element>, Error> {}
+ pub async fn read_end(&self) -> Result<(), Error> {}
+}
+
+impl<R: AsyncRead> Stream for Reader<R> {
+ type Item = impl From<Element>;
+
+ async fn poll_next(
+ self: std::pin::Pin<&mut Self>,
+ cx: &mut std::task::Context<'_>,
+ ) -> std::task::Poll<Option<Self::Item>> {
+ todo!()
+ }
+}