@@ -28,8 +28,6 @@ struct ResponsePayload {
2828
2929// Implementation of RequestPayload with a constructor function for easy creation
3030impl RequestPayload {
31- // Constructor function to create a new RequestPayload instance
32- // Takes a code string as input, and uses CLI arguments to populate other fields
3331 fn new ( code : & str ) -> RequestPayload {
3432 let cli = Cli :: parse ( ) ;
3533 RequestPayload {
@@ -56,34 +54,23 @@ pub async fn run_rustycli() -> Result<(), Box<dyn std::error::Error>> {
5654
5755 let client = Client :: new ( ) ;
5856
59- // Build the POST request with the playground URL, headers, and serialized JSON payload
6057 let request_builder = client
6158 . post ( PLAYGROUND_URL )
6259 . header ( CONTENT_TYPE , "application/json" )
6360 . json ( & request_payload) ;
6461
65- // Get a string representation of the request and print it
66- // let request_str = format!("{:#?}", request_builder);
67- // println!("{:?}", request_str);
68-
69- // Make the HTTP request to the playground and await the response
7062 let resp_json = request_builder
7163 . send ( )
7264 . await ?
7365 . json :: < ResponsePayload > ( )
7466 . await ?;
7567
76- // println!("{:?}", resp_json);
77-
78- // Display the output of the executed code (if any) or show an error message
79-
8068 let match_result = match ( resp_json. stdout , resp_json. stderr ) {
8169 ( Some ( stdout) , _) if !stdout. is_empty ( ) => stdout,
8270 ( _, Some ( stderr) ) => stderr,
8371 _ => String :: from ( "Error: No stdout or stderr found in the response." ) ,
8472 } ;
8573
8674 spinner. success ( & match_result) ;
87- // println!("{}", match_result);
8875 Ok ( ( ) )
8976}
0 commit comments