aboutsummaryrefslogtreecommitdiffstats
path: root/src/reader.rs
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@blos.sm>2024-06-12 10:15:48 +0100
committerLibravatar cel 🌸 <cel@blos.sm>2024-06-12 10:15:48 +0100
commita92aee921d6e3cfcb8bf2e08ceefd40a66df940f (patch)
treec60ee2a490f99a7d5861c865a9788660af213074 /src/reader.rs
parent844f3a5d11e4360e9d6bdb79cfed49287aa8b14d (diff)
downloadpeanuts-a92aee921d6e3cfcb8bf2e08ceefd40a66df940f.tar.gz
peanuts-a92aee921d6e3cfcb8bf2e08ceefd40a66df940f.tar.bz2
peanuts-a92aee921d6e3cfcb8bf2e08ceefd40a66df940f.zip
WIP: parsers
Diffstat (limited to 'src/reader.rs')
-rw-r--r--src/reader.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/reader.rs b/src/reader.rs
index 05afc73..26e540e 100644
--- a/src/reader.rs
+++ b/src/reader.rs
@@ -1,5 +1,5 @@
use futures::Stream;
-use tokio::io::AsyncRead;
+use tokio::io::AsyncBufRead;
use crate::{
element::{Element, Name, Namespace},
@@ -14,13 +14,19 @@ pub struct Reader<R> {
namespaces: Vec<(usize, Namespace)>,
}
-impl<R: AsyncRead> Reader<R> {
- pub async fn read(&self) -> Result<impl From<Element>, Error> {}
+impl<R> Reader<R>
+where
+ R: AsyncBufRead,
+{
+ pub async fn read(&self) -> Result<impl From<Element>, Error> {
+ let buf = self.stream.poll_fill_buf().await?;
+ todo!()
+ }
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> {
+impl<R: AsyncBufRead> Stream for Reader<R> {
type Item = impl From<Element>;
async fn poll_next(