Use BoxFuture
This commit is contained in:
parent
3cb7c65b70
commit
d0128a6d8a
|
@ -14,6 +14,7 @@ use boitalettres::server::Server as ImapServer;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use std::task::{Context, Poll};
|
use std::task::{Context, Poll};
|
||||||
use tower::Service;
|
use tower::Service;
|
||||||
|
use futures::future::BoxFuture;
|
||||||
|
|
||||||
pub struct Server {
|
pub struct Server {
|
||||||
pub login_provider: Box<dyn LoginProvider>,
|
pub login_provider: Box<dyn LoginProvider>,
|
||||||
|
@ -23,7 +24,7 @@ struct Connection;
|
||||||
impl Service<Request> for Connection {
|
impl Service<Request> for Connection {
|
||||||
type Response = Response;
|
type Response = Response;
|
||||||
type Error = anyhow::Error;
|
type Error = anyhow::Error;
|
||||||
type Future = Pin<Box<dyn futures::Future<Output = Result<Self::Response>> + Send>>;
|
type Future = BoxFuture<'static, Result<Self::Response>>;
|
||||||
|
|
||||||
fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||||
Poll::Ready(Ok(()))
|
Poll::Ready(Ok(()))
|
||||||
|
@ -62,7 +63,7 @@ struct Instance;
|
||||||
impl<'a> Service<&'a AddrStream> for Instance {
|
impl<'a> Service<&'a AddrStream> for Instance {
|
||||||
type Response = Connection;
|
type Response = Connection;
|
||||||
type Error = anyhow::Error;
|
type Error = anyhow::Error;
|
||||||
type Future = Pin<Box<dyn futures::Future<Output = Result<Self::Response>> + Send>>;
|
type Future = BoxFuture<'static, Result<Self::Response>>;
|
||||||
|
|
||||||
fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||||
Poll::Ready(Ok(()))
|
Poll::Ready(Ok(()))
|
||||||
|
|
Loading…
Reference in a new issue