@@ -127,9 +127,9 @@ pub trait Receiver: Debug + Sealed {}
127
127
128
128
/// Trait to specify channels for a message and service
129
129
pub trait Channels < S : Service > {
130
- /// The sender type, can be either spsc , oneshot or none
130
+ /// The sender type, can be either mpsc , oneshot or none
131
131
type Tx : Sender ;
132
- /// The receiver type, can be either spsc , oneshot or none
132
+ /// The receiver type, can be either mpsc , oneshot or none
133
133
///
134
134
/// For many services, the receiver is not needed, so it can be set to [`NoReceiver`].
135
135
type Rx : Receiver ;
@@ -315,14 +315,14 @@ pub mod channel {
315
315
316
316
/// SPSC channel, similar to tokio's mpsc channel
317
317
///
318
- /// For the rpc case, the send side can not be cloned, hence spsc instead of mpsc.
319
- pub mod spsc {
318
+ /// For the rpc case, the send side can not be cloned, hence mpsc instead of mpsc.
319
+ pub mod mpsc {
320
320
use std:: { fmt:: Debug , future:: Future , io, pin:: Pin , sync:: Arc } ;
321
321
322
322
use super :: { RecvError , SendError } ;
323
323
use crate :: RpcMessage ;
324
324
325
- /// Create a local spsc sender and receiver pair, with the given buffer size.
325
+ /// Create a local mpsc sender and receiver pair, with the given buffer size.
326
326
///
327
327
/// This is currently using a tokio channel pair internally.
328
328
pub fn channel < T > ( buffer : usize ) -> ( Sender < T > , Receiver < T > ) {
@@ -582,7 +582,7 @@ pub mod channel {
582
582
impl crate :: Receiver for NoReceiver { }
583
583
}
584
584
585
- /// Error when sending a oneshot or spsc message. For local communication,
585
+ /// Error when sending a oneshot or mpsc message. For local communication,
586
586
/// the only thing that can go wrong is that the receiver has been dropped.
587
587
///
588
588
/// For rpc communication, there can be any number of errors, so this is a
@@ -608,7 +608,7 @@ pub mod channel {
608
608
}
609
609
}
610
610
611
- /// Error when receiving a oneshot or spsc message. For local communication,
611
+ /// Error when receiving a oneshot or mpsc message. For local communication,
612
612
/// the only thing that can go wrong is that the sender has been closed.
613
613
///
614
614
/// For rpc communication, there can be any number of errors, so this is a
@@ -871,24 +871,24 @@ impl<M, R, S> Client<M, R, S> {
871
871
}
872
872
}
873
873
874
- /// Performs a request for which the server returns a spsc receiver.
874
+ /// Performs a request for which the server returns a mpsc receiver.
875
875
pub fn server_streaming < Req , Res > (
876
876
& self ,
877
877
msg : Req ,
878
878
local_response_cap : usize ,
879
- ) -> impl Future < Output = Result < channel:: spsc :: Receiver < Res > > > + Send + ' static
879
+ ) -> impl Future < Output = Result < channel:: mpsc :: Receiver < Res > > > + Send + ' static
880
880
where
881
881
S : Service ,
882
882
M : From < WithChannels < Req , S > > + Send + Sync + Unpin + ' static ,
883
883
R : From < Req > + Serialize + Send + Sync + ' static ,
884
- Req : Channels < S , Tx = channel:: spsc :: Sender < Res > , Rx = NoReceiver > + Send + ' static ,
884
+ Req : Channels < S , Tx = channel:: mpsc :: Sender < Res > , Rx = NoReceiver > + Send + ' static ,
885
885
Res : RpcMessage ,
886
886
{
887
887
let request = self . request ( ) ;
888
888
async move {
889
- let recv: channel:: spsc :: Receiver < Res > = match request. await ? {
889
+ let recv: channel:: mpsc :: Receiver < Res > = match request. await ? {
890
890
Request :: Local ( request) => {
891
- let ( tx, rx) = channel:: spsc :: channel ( local_response_cap) ;
891
+ let ( tx, rx) = channel:: mpsc :: channel ( local_response_cap) ;
892
892
request. send ( ( msg, tx) ) . await ?;
893
893
rx
894
894
}
@@ -911,26 +911,26 @@ impl<M, R, S> Client<M, R, S> {
911
911
local_update_cap : usize ,
912
912
) -> impl Future <
913
913
Output = Result < (
914
- channel:: spsc :: Sender < Update > ,
914
+ channel:: mpsc :: Sender < Update > ,
915
915
channel:: oneshot:: Receiver < Res > ,
916
916
) > ,
917
917
>
918
918
where
919
919
S : Service ,
920
920
M : From < WithChannels < Req , S > > + Send + Sync + Unpin + ' static ,
921
921
R : From < Req > + Serialize + ' static ,
922
- Req : Channels < S , Tx = channel:: oneshot:: Sender < Res > , Rx = channel:: spsc :: Receiver < Update > > ,
922
+ Req : Channels < S , Tx = channel:: oneshot:: Sender < Res > , Rx = channel:: mpsc :: Receiver < Update > > ,
923
923
Update : RpcMessage ,
924
924
Res : RpcMessage ,
925
925
{
926
926
let request = self . request ( ) ;
927
927
async move {
928
928
let ( update_tx, res_rx) : (
929
- channel:: spsc :: Sender < Update > ,
929
+ channel:: mpsc :: Sender < Update > ,
930
930
channel:: oneshot:: Receiver < Res > ,
931
931
) = match request. await ? {
932
932
Request :: Local ( request) => {
933
- let ( req_tx, req_rx) = channel:: spsc :: channel ( local_update_cap) ;
933
+ let ( req_tx, req_rx) = channel:: mpsc :: channel ( local_update_cap) ;
934
934
let ( res_tx, res_rx) = channel:: oneshot:: channel ( ) ;
935
935
request. send ( ( msg, res_tx, req_rx) ) . await ?;
936
936
( req_tx, res_rx)
@@ -947,32 +947,32 @@ impl<M, R, S> Client<M, R, S> {
947
947
}
948
948
}
949
949
950
- /// Performs a request for which the client can send updates, and the server returns a spsc receiver.
950
+ /// Performs a request for which the client can send updates, and the server returns a mpsc receiver.
951
951
pub fn bidi_streaming < Req , Update , Res > (
952
952
& self ,
953
953
msg : Req ,
954
954
local_update_cap : usize ,
955
955
local_response_cap : usize ,
956
- ) -> impl Future < Output = Result < ( channel:: spsc :: Sender < Update > , channel:: spsc :: Receiver < Res > ) > >
956
+ ) -> impl Future < Output = Result < ( channel:: mpsc :: Sender < Update > , channel:: mpsc :: Receiver < Res > ) > >
957
957
+ Send
958
958
+ ' static
959
959
where
960
960
S : Service ,
961
961
M : From < WithChannels < Req , S > > + Send + Sync + Unpin + ' static ,
962
962
R : From < Req > + Serialize + Send + ' static ,
963
- Req : Channels < S , Tx = channel:: spsc :: Sender < Res > , Rx = channel:: spsc :: Receiver < Update > >
963
+ Req : Channels < S , Tx = channel:: mpsc :: Sender < Res > , Rx = channel:: mpsc :: Receiver < Update > >
964
964
+ Send
965
965
+ ' static ,
966
966
Update : RpcMessage ,
967
967
Res : RpcMessage ,
968
968
{
969
969
let request = self . request ( ) ;
970
970
async move {
971
- let ( update_tx, res_rx) : ( channel:: spsc :: Sender < Update > , channel:: spsc :: Receiver < Res > ) =
971
+ let ( update_tx, res_rx) : ( channel:: mpsc :: Sender < Update > , channel:: mpsc :: Receiver < Res > ) =
972
972
match request. await ? {
973
973
Request :: Local ( request) => {
974
- let ( update_tx, update_rx) = channel:: spsc :: channel ( local_update_cap) ;
975
- let ( res_tx, res_rx) = channel:: spsc :: channel ( local_response_cap) ;
974
+ let ( update_tx, update_rx) = channel:: mpsc :: channel ( local_update_cap) ;
975
+ let ( res_tx, res_rx) = channel:: mpsc :: channel ( local_response_cap) ;
976
976
request. send ( ( msg, res_tx, update_rx) ) . await ?;
977
977
( update_tx, res_rx)
978
978
}
@@ -1120,7 +1120,7 @@ pub mod rpc {
1120
1120
channel:: {
1121
1121
none:: NoSender ,
1122
1122
oneshot,
1123
- spsc :: { self , DynReceiver , DynSender } ,
1123
+ mpsc :: { self , DynReceiver , DynSender } ,
1124
1124
RecvError , SendError ,
1125
1125
} ,
1126
1126
util:: { now_or_never, AsyncReadVarintExt , WriteVarintExt } ,
@@ -1290,9 +1290,9 @@ pub mod rpc {
1290
1290
}
1291
1291
}
1292
1292
1293
- impl < T : RpcMessage > From < quinn:: RecvStream > for spsc :: Receiver < T > {
1293
+ impl < T : RpcMessage > From < quinn:: RecvStream > for mpsc :: Receiver < T > {
1294
1294
fn from ( read : quinn:: RecvStream ) -> Self {
1295
- spsc :: Receiver :: Boxed ( Box :: new ( QuinnReceiver {
1295
+ mpsc :: Receiver :: Boxed ( Box :: new ( QuinnReceiver {
1296
1296
recv : read,
1297
1297
_marker : PhantomData ,
1298
1298
} ) )
@@ -1320,9 +1320,9 @@ pub mod rpc {
1320
1320
}
1321
1321
}
1322
1322
1323
- impl < T : RpcMessage > From < quinn:: SendStream > for spsc :: Sender < T > {
1323
+ impl < T : RpcMessage > From < quinn:: SendStream > for mpsc :: Sender < T > {
1324
1324
fn from ( write : quinn:: SendStream ) -> Self {
1325
- spsc :: Sender :: Boxed ( Arc :: new ( QuinnSender ( tokio:: sync:: Mutex :: new (
1325
+ mpsc :: Sender :: Boxed ( Arc :: new ( QuinnSender ( tokio:: sync:: Mutex :: new (
1326
1326
QuinnSenderState :: Open ( QuinnSenderInner {
1327
1327
send : write,
1328
1328
buffer : SmallVec :: new ( ) ,
0 commit comments