use std::collections::HashSet; use futures::Sink; use tokio::io::AsyncWrite; use crate::{ element::{Element, Name, NamespaceDeclaration}, error::Error, xml::{self, composers::Composer, parsers_complete::Parser, ETag}, }; // pub struct Writer { pub struct Writer { inner: W, depth: Vec, namespaces: Vec>, } impl Writer { pub async fn write(&mut self, element: Element) -> Result<(), Error> { todo!() } pub async fn write_start(&mut self, element: Element) -> Result<(), Error> { todo!() } pub async fn write_end(&mut self) -> Result<(), Error> { todo!() // let e_tag; // if let Some(name) = self.depth.pop() { // if let Some(prefix) = name.namespace.prefix { // e_tag = xml::ETag { // name: xml::QName::PrefixedName(xml::PrefixedName { // prefix: xml::Prefix::parse_full(&prefix)?, // local_part: xml::LocalPart::parse_full(&name.name)?, // }), // }; // e_tag.write(&mut self.inner).await?; // Ok(()) // } else { // e_tag = xml::ETag { // name: xml::QName::UnprefixedName(xml::UnprefixedName::parse_full(&name.name)?), // }; // e_tag.write(&mut self.inner).await?; // Ok(()) // } // } else { // return Err(Error::NotInElement("".to_string())); // } } } impl> Sink for Writer { type Error = Error; fn poll_ready( self: std::pin::Pin<&mut Self>, cx: &mut std::task::Context<'_>, ) -> std::task::Poll> { todo!() } fn start_send(self: std::pin::Pin<&mut Self>, item: E) -> Result<(), Self::Error> { todo!() } fn poll_flush( self: std::pin::Pin<&mut Self>, cx: &mut std::task::Context<'_>, ) -> std::task::Poll> { todo!() } fn poll_close( self: std::pin::Pin<&mut Self>, cx: &mut std::task::Context<'_>, ) -> std::task::Poll> { todo!() } }