11use playground_server:: {
2- pick_ports, PortConfiguration , PlaygroundServer , AppState ,
3- LangServerToWasmMessage , FrontendMessage , PreLangServerToWasmMessage ,
2+ pick_ports, AppState , FrontendMessage , LangServerToWasmMessage , PlaygroundServer ,
3+ PortConfiguration , PreLangServerToWasmMessage ,
44} ;
55use std:: collections:: HashMap ;
66use tokio:: io:: AsyncBufReadExt ;
@@ -12,11 +12,14 @@ pub struct Playground2Server {
1212}
1313
1414impl Playground2Server {
15- pub async fn run ( self , listener : tokio:: net:: TcpListener ) -> Result < ( ) , Box < dyn std:: error:: Error + Send > > {
15+ pub async fn run (
16+ self ,
17+ listener : tokio:: net:: TcpListener ,
18+ ) -> Result < ( ) , Box < dyn std:: error:: Error + Send > > {
1619 let server = PlaygroundServer {
1720 app_state : self . app_state ,
1821 } ;
19-
22+
2023 server. run ( listener) . await
2124 }
2225}
@@ -38,8 +41,9 @@ pub async fn run_server() -> anyhow::Result<()> {
3841 let port_picks = pick_ports ( PortConfiguration {
3942 base_port : 3900 ,
4043 max_attempts : 100 ,
41- } ) . await ?;
42-
44+ } )
45+ . await ?;
46+
4347 let server = Playground2Server {
4448 app_state : AppState {
4549 broadcast_rx,
@@ -75,14 +79,13 @@ pub async fn run_server() -> anyhow::Result<()> {
7579 }
7680 ) ) ;
7781 tokio:: time:: sleep ( std:: time:: Duration :: from_secs ( 1 ) ) . await ;
78- let playground_message = LangServerToWasmMessage :: PlaygroundMessage (
79- FrontendMessage :: run_test {
82+ let playground_message =
83+ LangServerToWasmMessage :: PlaygroundMessage ( FrontendMessage :: run_test {
8084 function_name : "ExtractResume" . to_string ( ) ,
8185 test_name : "vaibhav_resume" . to_string ( ) ,
82- }
83- ) ;
86+ } ) ;
8487 tracing:: info!( "Sending playground message: {:?}" , playground_message) ;
85- let _ = broadcast_tx. send ( playground_message) ;
88+ let _ = broadcast_tx. send ( playground_message) ;
8689 }
8790 PreLangServerToWasmMessage :: FrontendMessage ( msg) => {
8891 tracing:: info!( "Received frontend message: {:?}" , msg) ;
@@ -98,26 +101,25 @@ pub async fn run_server() -> anyhow::Result<()> {
98101 tokio:: spawn ( async move {
99102 let stdin = tokio:: io:: stdin ( ) ;
100103 let mut lines = tokio:: io:: BufReader :: new ( stdin) . lines ( ) ;
101-
104+
102105 loop {
103106 println ! ( "Press enter to send test message" ) ;
104107 let Ok ( Some ( _line) ) = lines. next_line ( ) . await else {
105108 break ;
106109 } ;
107- let playground_message = LangServerToWasmMessage :: PlaygroundMessage (
108- FrontendMessage :: run_test {
110+ let playground_message =
111+ LangServerToWasmMessage :: PlaygroundMessage ( FrontendMessage :: run_test {
109112 function_name : "ExtractResume" . to_string ( ) ,
110113 test_name : "vaibhav_resume" . to_string ( ) ,
111- }
112- ) ;
114+ } ) ;
113115 tracing:: info!( "Sending playground message: {:?}" , playground_message) ;
114- let _ = broadcast_tx. send ( playground_message) ;
116+ let _ = broadcast_tx. send ( playground_message) ;
115117 }
116-
118+
117119 Ok :: < ( ) , anyhow:: Error > ( ( ) )
118120 } ) ;
119121
120122 let _ = playground_task. await ?;
121123
122124 Ok ( ( ) )
123- }
125+ }
0 commit comments