proto: Refactor Request struct

Fixes #4
This commit is contained in:
Jill 2022-06-27 14:44:20 +02:00
parent fc5f093564
commit 2af6a7d781
No known key found for this signature in database
GPG key ID: 09A5A2688F13FAC1
4 changed files with 7 additions and 5 deletions

View file

@ -1,3 +0,0 @@
use imap_codec::types::command::Command;
pub type Request = Command;

5
src/proto/req/mod.rs Normal file
View file

@ -0,0 +1,5 @@
use imap_codec::types::command::Command;
pub struct Request {
pub command: Command,
}

View file

@ -157,7 +157,7 @@ where
fn call(&mut self, req: Request) -> Self::Future { fn call(&mut self, req: Request) -> Self::Future {
use futures::{FutureExt, TryFutureExt}; use futures::{FutureExt, TryFutureExt};
let tag = req.tag.clone(); let tag = req.command.tag.clone();
self.inner.call(req).map_ok(|res| (Some(tag), res)).boxed() self.inner.call(req).map_ok(|res| (Some(tag), res)).boxed()
} }

View file

@ -67,7 +67,7 @@ where
*this.read_buf = input.into(); *this.read_buf = input.into();
let req = command; let req = Request { command };
return Poll::Ready(Some(Ok(req))); return Poll::Ready(Some(Ok(req)));
} }
} }