From ceb1bca7a4f1ccf9bfc6a050adc4387e992c9403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?cel=20=F0=9F=8C=B8?= Date: Thu, 31 Oct 2024 20:54:19 +0000 Subject: [PATCH] fix build --- src/main.rs | 5 +- src/reader.rs | 130 ++++++++++++++++++++++++------------------------- src/xml/mod.rs | 2 +- 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( " Background Mark 1 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 Reader { } } -impl Reader -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, String>) -> Result { - 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::(Error::ParseError(input.to_owned())), - }, - } - } +// impl Reader +// 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, String>) -> Result { +// 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::(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>(&mut self) -> Result { - // 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::(Error::ParseError(input.to_owned())), - // }, - // } - // } - // self.inner.consume(len); +// } +// }, +// crate::xml::Element::NotEmpty(_, _, _) => todo!(), +// } - // // Ok(element) - // todo!() - // } - // pub async fn read_start(&self) -> Result, 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>(&mut self) -> Result { +// 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::(Error::ParseError(input.to_owned())), +// }, +// } +// } +// self.inner.consume(len); + +// // Ok(element) +// todo!() +// } +// pub async fn read_start(&self) -> Result, Error> { +// todo!() +// } +// pub async fn read_end(&self) -> Result<(), Error> { +// todo!() +// } +// } // impl Stream for Reader { // type Item = impl From; 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)]