2024-03-04 16:14:28 +00:00
|
|
|
use futures::{AsyncWrite, Sink};
|
|
|
|
|
|
|
|
use crate::{
|
|
|
|
element::{Element, Name, Namespace},
|
|
|
|
error::Error,
|
|
|
|
};
|
|
|
|
|
2024-11-01 18:36:11 +00:00
|
|
|
// pub struct Writer<W, C = Composer> {
|
2024-03-04 16:14:28 +00:00
|
|
|
pub struct Writer<W> {
|
2024-11-01 18:36:11 +00:00
|
|
|
writer: W,
|
2024-03-04 16:14:28 +00:00
|
|
|
depth: Vec<Name>,
|
|
|
|
namespaces: Vec<(usize, Namespace)>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<W: AsyncWrite> Writer<W> {
|
2024-06-14 13:11:32 +01:00
|
|
|
pub async fn write(&self, element: impl Into<Element>) -> Result<(), Error> {
|
|
|
|
todo!()
|
|
|
|
}
|
|
|
|
pub async fn write_start(&self, element: impl Into<Element>) -> Result<(), Error> {
|
|
|
|
todo!()
|
|
|
|
}
|
|
|
|
pub async fn write_end(&self) -> Result<(), Error> {
|
|
|
|
todo!()
|
|
|
|
}
|
2024-03-04 16:14:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl<W: AsyncWrite, E: Into<Element>> Sink<E> for Writer<W> {
|
|
|
|
type Error = Error;
|
|
|
|
|
|
|
|
fn poll_ready(
|
|
|
|
self: std::pin::Pin<&mut Self>,
|
|
|
|
cx: &mut std::task::Context<'_>,
|
|
|
|
) -> std::task::Poll<Result<(), Self::Error>> {
|
|
|
|
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<Result<(), Self::Error>> {
|
|
|
|
todo!()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn poll_close(
|
|
|
|
self: std::pin::Pin<&mut Self>,
|
|
|
|
cx: &mut std::task::Context<'_>,
|
|
|
|
) -> std::task::Poll<Result<(), Self::Error>> {
|
|
|
|
todo!()
|
|
|
|
}
|
|
|
|
}
|