File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -105,13 +105,17 @@ where
105
105
R : AsyncRead + Unpin ,
106
106
W : AsyncWrite + Unpin ,
107
107
{
108
- pub async fn write_message ( & mut self , msg : JsonRpcMessage ) -> Result < ( ) , std:: io:: Error > {
108
+ pub async fn write_message (
109
+ self : & mut Pin < & mut Self > ,
110
+ msg : JsonRpcMessage ,
111
+ ) -> Result < ( ) , std:: io:: Error > {
109
112
let json = serde_json:: to_string ( & msg) ?;
110
- Pin :: new ( & mut self . writer )
111
- . write_all ( json. as_bytes ( ) )
112
- . await ?;
113
- Pin :: new ( & mut self . writer ) . write_all ( b"\n " ) . await ?;
114
- Pin :: new ( & mut self . writer ) . flush ( ) . await ?;
113
+
114
+ let mut this = self . as_mut ( ) . project ( ) ;
115
+ this. writer . write_all ( json. as_bytes ( ) ) . await ?;
116
+ this. writer . write_all ( b"\n " ) . await ?;
117
+ this. writer . flush ( ) . await ?;
118
+
115
119
Ok ( ( ) )
116
120
}
117
121
}
@@ -139,6 +143,7 @@ where
139
143
{
140
144
use futures:: StreamExt ;
141
145
let mut service = self . service ;
146
+ let mut transport = Pin :: new ( & mut transport) ;
142
147
143
148
tracing:: info!( "Server started" ) ;
144
149
while let Some ( msg_result) = transport. next ( ) . await {
You can’t perform that action at this time.
0 commit comments