diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-10-14 15:33:29 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-10-14 15:33:29 -0400 |
commit | ec976fe91259b9950980b0c35fb655a1dd99e97f (patch) | |
tree | 250bd07c638f0c0aacb0f5fa79990e498af08af0 | |
parent | 05a26723ee1329cf8e809961d5d7bc4fda6e1db6 (diff) | |
download | teleterm-ec976fe91259b9950980b0c35fb655a1dd99e97f.tar.gz teleterm-ec976fe91259b9950980b0c35fb655a1dd99e97f.zip |
simplify some types
-rw-r--r-- | src/client.rs | 10 | ||||
-rw-r--r-- | src/protocol.rs | 3 | ||||
-rw-r--r-- | src/server.rs | 10 |
3 files changed, 11 insertions, 12 deletions
diff --git a/src/client.rs b/src/client.rs index 75edfbf..0fc1467 100644 --- a/src/client.rs +++ b/src/client.rs @@ -13,13 +13,13 @@ enum ReadSocket< S: tokio::io::AsyncRead + tokio::io::AsyncWrite + Send + 'static, > { NotConnected, - Connected(crate::protocol::FramedReader<tokio::io::ReadHalf<S>>), + Connected(crate::protocol::FramedReadHalf<S>), ReadingMessage( Box< dyn futures::future::Future< Item = ( crate::protocol::Message, - crate::protocol::FramedReader<tokio::io::ReadHalf<S>>, + crate::protocol::FramedReadHalf<S>, ), Error = Error, > + Send, @@ -39,13 +39,11 @@ enum WriteSocket< > + Send, >, ), - Connected(crate::protocol::FramedWriter<tokio::io::WriteHalf<S>>), + Connected(crate::protocol::FramedWriteHalf<S>), WritingMessage( Box< dyn futures::future::Future< - Item = crate::protocol::FramedWriter< - tokio::io::WriteHalf<S>, - >, + Item = crate::protocol::FramedWriteHalf<S>, Error = Error, > + Send, >, diff --git a/src/protocol.rs b/src/protocol.rs index ee9eb04..b47cb37 100644 --- a/src/protocol.rs +++ b/src/protocol.rs @@ -1,6 +1,9 @@ use crate::prelude::*; use std::convert::{TryFrom as _, TryInto as _}; +pub type FramedReadHalf<S> = FramedReader<tokio::io::ReadHalf<S>>; +pub type FramedWriteHalf<S> = FramedWriter<tokio::io::WriteHalf<S>>; + #[derive(Debug, Clone, PartialEq, Eq)] pub struct Session { pub id: String, diff --git a/src/server.rs b/src/server.rs index 8f7ea1c..55346a2 100644 --- a/src/server.rs +++ b/src/server.rs @@ -6,13 +6,13 @@ pub mod tls; enum ReadSocket< S: tokio::io::AsyncRead + tokio::io::AsyncWrite + Send + 'static, > { - Connected(crate::protocol::FramedReader<tokio::io::ReadHalf<S>>), + Connected(crate::protocol::FramedReadHalf<S>), Reading( Box< dyn futures::future::Future< Item = ( crate::protocol::Message, - crate::protocol::FramedReader<tokio::io::ReadHalf<S>>, + crate::protocol::FramedReadHalf<S>, ), Error = Error, > + Send, @@ -23,13 +23,11 @@ enum ReadSocket< enum WriteSocket< S: tokio::io::AsyncRead + tokio::io::AsyncWrite + Send + 'static, > { - Connected(crate::protocol::FramedWriter<tokio::io::WriteHalf<S>>), + Connected(crate::protocol::FramedWriteHalf<S>), Writing( Box< dyn futures::future::Future< - Item = crate::protocol::FramedWriter< - tokio::io::WriteHalf<S>, - >, + Item = crate::protocol::FramedWriteHalf<S>, Error = Error, > + Send, >, |