@@ -4,7 +4,7 @@ use futures_lite::Stream;
44use futures_sink:: Sink ;
55
66use crate :: {
7- transport:: { Connection , ConnectionErrors , LocalAddr , ServerEndpoint } ,
7+ transport:: { self , ConnectionErrors , LocalAddr } ,
88 RpcMessage , Service ,
99} ;
1010use core:: fmt;
@@ -100,28 +100,28 @@ impl error::Error for RecvError {}
100100/// A `tokio::sync::mpsc` based server endpoint.
101101///
102102/// Created using [connection].
103- pub struct MpscServerEndpoint < S : Service > {
103+ pub struct ServerEndpoint < S : Service > {
104104 #[ allow( clippy:: type_complexity) ]
105105 stream : Arc < Mutex < mpsc:: Receiver < ( SendSink < S :: Res > , RecvStream < S :: Req > ) > > > ,
106106}
107107
108- impl < S : Service > Clone for MpscServerEndpoint < S > {
108+ impl < S : Service > Clone for ServerEndpoint < S > {
109109 fn clone ( & self ) -> Self {
110110 Self {
111111 stream : self . stream . clone ( ) ,
112112 }
113113 }
114114}
115115
116- impl < S : Service > fmt:: Debug for MpscServerEndpoint < S > {
116+ impl < S : Service > fmt:: Debug for ServerEndpoint < S > {
117117 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
118- f. debug_struct ( "MpscServerEndpoint " )
118+ f. debug_struct ( "ServerEndpoint " )
119119 . field ( "stream" , & self . stream )
120120 . finish ( )
121121 }
122122}
123123
124- impl < S : Service > ConnectionErrors for MpscServerEndpoint < S > {
124+ impl < S : Service > ConnectionErrors for ServerEndpoint < S > {
125125 type SendError = self :: SendError ;
126126
127127 type RecvError = self :: RecvError ;
@@ -131,12 +131,12 @@ impl<S: Service> ConnectionErrors for MpscServerEndpoint<S> {
131131
132132type Socket < In , Out > = ( self :: SendSink < Out > , self :: RecvStream < In > ) ;
133133
134- impl < S : Service > ConnectionCommon < S :: Req , S :: Res > for MpscServerEndpoint < S > {
134+ impl < S : Service > ConnectionCommon < S :: Req , S :: Res > for ServerEndpoint < S > {
135135 type SendSink = SendSink < S :: Res > ;
136136 type RecvStream = RecvStream < S :: Req > ;
137137}
138138
139- impl < S : Service > ServerEndpoint < S :: Req , S :: Res > for MpscServerEndpoint < S > {
139+ impl < S : Service > transport :: ServerEndpoint < S :: Req , S :: Res > for ServerEndpoint < S > {
140140 async fn accept_bi ( & self ) -> Result < ( Self :: SendSink , Self :: RecvStream ) , AcceptBiError > {
141141 let ( send, recv) = self
142142 . stream
@@ -153,20 +153,20 @@ impl<S: Service> ServerEndpoint<S::Req, S::Res> for MpscServerEndpoint<S> {
153153 }
154154}
155155
156- impl < S : Service > ConnectionErrors for MpscConnection < S > {
156+ impl < S : Service > ConnectionErrors for Connection < S > {
157157 type SendError = self :: SendError ;
158158
159159 type RecvError = self :: RecvError ;
160160
161161 type OpenError = self :: OpenBiError ;
162162}
163163
164- impl < S : Service > ConnectionCommon < S :: Res , S :: Req > for MpscConnection < S > {
164+ impl < S : Service > ConnectionCommon < S :: Res , S :: Req > for Connection < S > {
165165 type SendSink = SendSink < S :: Req > ;
166166 type RecvStream = RecvStream < S :: Res > ;
167167}
168168
169- impl < S : Service > Connection < S :: Res , S :: Req > for MpscConnection < S > {
169+ impl < S : Service > transport :: Connection < S :: Res , S :: Req > for Connection < S > {
170170 async fn open_bi ( & self ) -> result:: Result < Socket < S :: Res , S :: Req > , self :: OpenBiError > {
171171 let ( local_send, remote_recv) = mpsc:: channel :: < S :: Req > ( 128 ) ;
172172 let ( remote_send, local_recv) = mpsc:: channel :: < S :: Res > ( 128 ) ;
@@ -186,25 +186,25 @@ impl<S: Service> Connection<S::Res, S::Req> for MpscConnection<S> {
186186 }
187187}
188188
189- /// A mpsc based connection to a server endpoint.
189+ /// A tokio::sync:: mpsc based connection to a server endpoint.
190190///
191191/// Created using [connection].
192- pub struct MpscConnection < S : Service > {
192+ pub struct Connection < S : Service > {
193193 #[ allow( clippy:: type_complexity) ]
194194 sink : mpsc:: Sender < ( SendSink < S :: Res > , RecvStream < S :: Req > ) > ,
195195}
196196
197- impl < S : Service > Clone for MpscConnection < S > {
197+ impl < S : Service > Clone for Connection < S > {
198198 fn clone ( & self ) -> Self {
199199 Self {
200200 sink : self . sink . clone ( ) ,
201201 }
202202 }
203203}
204204
205- impl < S : Service > fmt:: Debug for MpscConnection < S > {
205+ impl < S : Service > fmt:: Debug for Connection < S > {
206206 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
207- f. debug_struct ( "MpscClientChannel " )
207+ f. debug_struct ( "ClientChannel " )
208208 . field ( "sink" , & self . sink )
209209 . finish ( )
210210 }
@@ -277,12 +277,12 @@ impl std::error::Error for CreateChannelError {}
277277/// Create a mpsc server endpoint and a connected mpsc client channel.
278278///
279279/// `buffer` the size of the buffer for each channel. Keep this at a low value to get backpressure
280- pub fn connection < S : Service > ( buffer : usize ) -> ( MpscServerEndpoint < S > , MpscConnection < S > ) {
280+ pub fn connection < S : Service > ( buffer : usize ) -> ( ServerEndpoint < S > , Connection < S > ) {
281281 let ( sink, stream) = mpsc:: channel ( buffer) ;
282282 (
283- MpscServerEndpoint {
283+ ServerEndpoint {
284284 stream : Arc :: new ( Mutex :: new ( stream) ) ,
285285 } ,
286- MpscConnection { sink } ,
286+ Connection { sink } ,
287287 )
288288}
0 commit comments