aboutsummaryrefslogtreecommitdiffstats
path: root/src/writer.rs
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@blos.sm>2024-03-04 16:14:28 +0000
committerLibravatar cel 🌸 <cel@blos.sm>2024-03-04 16:14:28 +0000
commit844f3a5d11e4360e9d6bdb79cfed49287aa8b14d (patch)
tree5525c4f134ef3d7a6082935baa61e6097670c968 /src/writer.rs
downloadpeanuts-844f3a5d11e4360e9d6bdb79cfed49287aa8b14d.tar.gz
peanuts-844f3a5d11e4360e9d6bdb79cfed49287aa8b14d.tar.bz2
peanuts-844f3a5d11e4360e9d6bdb79cfed49287aa8b14d.zip
initial commit
Diffstat (limited to 'src/writer.rs')
-rw-r--r--src/writer.rs47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/writer.rs b/src/writer.rs
new file mode 100644
index 0000000..d7fc037
--- /dev/null
+++ b/src/writer.rs
@@ -0,0 +1,47 @@
+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> {}
+ pub async fn write_start(&self, element: impl Into<Element>) -> Result<(), Error> {}
+ pub async fn write_end(&self) -> Result<(), Error> {}
+}
+
+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!()
+ }
+}