aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@bunny.garden>2024-10-31 20:54:19 +0000
committerLibravatar cel 🌸 <cel@bunny.garden>2024-10-31 20:54:19 +0000
commitceb1bca7a4f1ccf9bfc6a050adc4387e992c9403 (patch)
tree0f8ac92b86596d70f0e6f65e764e562bea485c23
parent793bc4bfea65d5d6a6f80507d2f0f659ecb38221 (diff)
downloadpeanuts-ceb1bca7a4f1ccf9bfc6a050adc4387e992c9403.tar.gz
peanuts-ceb1bca7a4f1ccf9bfc6a050adc4387e992c9403.tar.bz2
peanuts-ceb1bca7a4f1ccf9bfc6a050adc4387e992c9403.zip
fix build
-rw-r--r--src/main.rs5
-rw-r--r--src/reader.rs130
-rw-r--r--src/xml/mod.rs2
3 files changed, 69 insertions, 68 deletions
diff --git a/src/main.rs b/src/main.rs
index b08c197..ef69011 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,7 +1,8 @@
-use peanuts::xml::document;
+use peanuts::xml::parsers::Parser;
+use peanuts::xml::Document;
fn main() {
- let document = document(
+ let document = Document::parse(
"<?xml version=\"1.0\"?>
<TEST>
<block1>Background Mark 1</block1>
diff --git a/src/reader.rs b/src/reader.rs
index b0d21db..313de4c 100644
--- a/src/reader.rs
+++ b/src/reader.rs
@@ -26,74 +26,74 @@ impl<R> Reader<R> {
}
}
-impl<R> Reader<R>
-where
- R: AsyncBufReadExt + Unpin,
-{
- /// could resursively read and include namespace tree with values to be shadowed within new local context
- async fn read_recursive(&mut self, namespaces: BTreeMap<Option<String>, String>) -> Result<Element, Error> {
- let element;
- let len;
- loop {
- let buf = self.inner.fill_buf().await?;
- let input = str::from_utf8(buf)?;
- match crate::xml::element(input) {
- Ok((rest, e)) => {
- element = e;
- len = buf.len() - rest.len();
- break;
- }
- Err(e) => match e {
- Err::Incomplete(_) => (),
- e => return Err::<E, Error>(Error::ParseError(input.to_owned())),
- },
- }
- }
+// impl<R> Reader<R>
+// where
+// R: AsyncBufReadExt + Unpin,
+// {
+// /// could resursively read and include namespace tree with values to be shadowed within new local context
+// async fn read_recursive(&mut self, namespaces: BTreeMap<Option<String>, String>) -> Result<Element, Error> {
+// let element;
+// let len;
+// loop {
+// let buf = self.inner.fill_buf().await?;
+// let input = str::from_utf8(buf)?;
+// match crate::xml::element(input) {
+// Ok((rest, e)) => {
+// element = e;
+// len = buf.len() - rest.len();
+// break;
+// }
+// Err(e) => match e {
+// Err::Incomplete(_) => (),
+// e => return Err::<E, Error>(Error::ParseError(input.to_owned())),
+// },
+// }
+// }
- let final;
- match element {
- crate::xml::Element::Empty(e) => {
- let final = Element {
-
- }
- },
- crate::xml::Element::NotEmpty(_, _, _) => todo!(),
- }
+// let final;
+// match element {
+// crate::xml::Element::Empty(e) => {
+// let final = Element {
- self.inner.consume(len);
- todo!()
- }
- /// reads entire next prolog, element, or misc
- // pub async fn read<E: From<Element>>(&mut self) -> Result<E, Error> {
- // let element;
- // let len;
- // loop {
- // let buf = self.inner.fill_buf().await?;
- // let input = str::from_utf8(buf)?;
- // match crate::xml::element(input) {
- // Ok((rest, e)) => {
- // element = e;
- // len = buf.len() - rest.len();
- // break;
- // }
- // Err(e) => match e {
- // Err::Incomplete(_) => (),
- // e => return Err::<E, Error>(Error::ParseError(input.to_owned())),
- // },
- // }
- // }
- // self.inner.consume(len);
+// }
+// },
+// crate::xml::Element::NotEmpty(_, _, _) => todo!(),
+// }
- // // Ok(element)
- // todo!()
- // }
- // pub async fn read_start(&self) -> Result<impl From<Element>, Error> {
- // todo!()
- // }
- // pub async fn read_end(&self) -> Result<(), Error> {
- // todo!()
- // }
-}
+// self.inner.consume(len);
+// todo!()
+// }
+// /// reads entire next prolog, element, or misc
+// pub async fn read<E: From<Element>>(&mut self) -> Result<E, Error> {
+// let element;
+// let len;
+// loop {
+// let buf = self.inner.fill_buf().await?;
+// let input = str::from_utf8(buf)?;
+// match crate::xml::element(input) {
+// Ok((rest, e)) => {
+// element = e;
+// len = buf.len() - rest.len();
+// break;
+// }
+// Err(e) => match e {
+// Err::Incomplete(_) => (),
+// e => return Err::<E, Error>(Error::ParseError(input.to_owned())),
+// },
+// }
+// }
+// self.inner.consume(len);
+
+// // Ok(element)
+// todo!()
+// }
+// pub async fn read_start(&self) -> Result<impl From<Element>, Error> {
+// todo!()
+// }
+// pub async fn read_end(&self) -> Result<(), Error> {
+// todo!()
+// }
+// }
// impl<R: AsyncBufRead> Stream for Reader<R> {
// type Item = impl From<Element>;
diff --git a/src/xml/mod.rs b/src/xml/mod.rs
index b1d6ea5..d1b9ddf 100644
--- a/src/xml/mod.rs
+++ b/src/xml/mod.rs
@@ -1,6 +1,6 @@
use std::char;
-mod parsers;
+pub mod parsers;
/// [1] NSAttName ::= PrefixedAttName | DefaultAttName
#[derive(Clone, Debug)]