aboutsummaryrefslogblamecommitdiffstats
path: root/src/writer.rs
blob: 456a5a1665cc27d0f0078d41eb0590328cdf5d94 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14













                                        








                                                                                       





























                                                                                       
use futures::{AsyncWrite, Sink};

use crate::{
    element::{Element, Name, Namespace},
    error::Error,
};

pub struct Writer<W> {
    stream: W,
    depth: Vec<Name>,
    namespaces: Vec<(usize, Namespace)>,
}

impl<W: AsyncWrite> Writer<W> {
    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!()
    }
}

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!()
    }
}