forked from KokaKiwi/boitalettres
style: Use tower-provided type-alias when useful
This commit is contained in:
parent
54aa382f8b
commit
05b5efc8bf
2 changed files with 7 additions and 6 deletions
|
@ -20,7 +20,7 @@ pub enum Error<A> {
|
|||
#[error("Error occured when accepting new connections")]
|
||||
Accept(#[source] A),
|
||||
#[error("Error occured on service creation")]
|
||||
MakeService(#[source] Box<dyn std::error::Error + Send + Sync + 'static>),
|
||||
MakeService(#[source] tower::BoxError),
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone)]
|
||||
|
@ -51,7 +51,7 @@ where
|
|||
I: Accept,
|
||||
I::Conn: AsyncRead + AsyncWrite + Unpin + Send + 'static,
|
||||
S: MakeServiceRef<I::Conn, Request, Response = Response>,
|
||||
S::MakeError: Into<Box<dyn std::error::Error + Send + Sync + 'static>> + std::fmt::Display,
|
||||
S::MakeError: Into<tower::BoxError> + std::fmt::Display,
|
||||
S::Error: std::fmt::Display,
|
||||
S::Future: Send + 'static,
|
||||
S::Service: Send + 'static,
|
||||
|
|
|
@ -8,7 +8,8 @@ use futures::stream::Stream;
|
|||
|
||||
use crate::proto::{Request, Response};
|
||||
|
||||
type Error = Box<dyn std::error::Error + Send + Sync + 'static>;
|
||||
type Error = tower::BoxError;
|
||||
type Result<T, E = Error> = std::result::Result<T, E>;
|
||||
|
||||
#[pin_project::pin_project]
|
||||
pub struct Connection<C> {
|
||||
|
@ -32,7 +33,7 @@ impl<C> Stream for Connection<C>
|
|||
where
|
||||
C: AsyncRead + Unpin,
|
||||
{
|
||||
type Item = Result<Request, Error>;
|
||||
type Item = Result<Request>;
|
||||
|
||||
fn poll_next(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Option<Self::Item>> {
|
||||
use imap_codec::parse::command::command as parse_command;
|
||||
|
@ -75,7 +76,7 @@ impl<C> Connection<C>
|
|||
where
|
||||
C: AsyncWrite,
|
||||
{
|
||||
fn poll_flush_buffer(self: Pin<&mut Self>, cx: &mut task::Context) -> Poll<Result<(), Error>> {
|
||||
fn poll_flush_buffer(self: Pin<&mut Self>, cx: &mut task::Context) -> Poll<Result<()>> {
|
||||
use bytes::Buf;
|
||||
|
||||
let mut this = self.project();
|
||||
|
@ -89,7 +90,7 @@ where
|
|||
Poll::Ready(Ok(()))
|
||||
}
|
||||
|
||||
pub(crate) fn send(&mut self, item: Response) -> Result<(), Error> {
|
||||
pub(crate) fn send(&mut self, item: Response) -> Result<()> {
|
||||
use bytes::BufMut;
|
||||
use imap_codec::codec::Encode;
|
||||
|
||||
|
|
Loading…
Reference in a new issue