refactor(proto): replace anyhow with thiserror in writers

This commit is contained in:
Jindřich Moravec 2023-12-15 15:58:11 +01:00
parent bb39d138d8
commit 58c69928a1
5 changed files with 21 additions and 6 deletions

View file

@ -1,4 +1,5 @@
use async_trait::async_trait;
use tokio::io;
use tokio::io::{AsyncWrite, AsyncWriteExt};
pub struct ProtoWriter<W>
@ -19,7 +20,7 @@ where
#[async_trait]
pub trait ProtoFlush {
async fn flush(&mut self) -> anyhow::Result<()>;
async fn flush(&mut self) -> Result<(), io::Error>;
}
#[async_trait]
@ -27,7 +28,7 @@ impl<W> ProtoFlush for ProtoWriter<W>
where
W: AsyncWrite + Unpin + Send,
{
async fn flush(&mut self) -> anyhow::Result<()> {
async fn flush(&mut self) -> Result<(), io::Error> {
self.inner.flush().await?;
Ok(())
}