on master help sign in
types: simplify working with client's launch args
aac586bDmitry Sharshakov
helix-dap/examples/dap-basic.rs+1−4
@@ -33,10 +33,7 @@ pub async fn main() -> Result<()> {
33 program: "/tmp/godebug/main".to_owned(),
33 program: "/tmp/godebug/main".to_owned(),
34 };
34 };
35
35
36− println!(
37− "launch: {:?}",
38− client.launch(serde_json::to_value(args)?).await
36+ println!("launch: {:?}", client.launch(args).await);
39− );
40
37
41 println!(
38 println!(
42 "breakpoints: {:#?}",
39 "breakpoints: {:#?}",
helix-dap/src/client.rs+3−2
@@ -372,8 +372,9 @@ impl Client {
372 Ok(())
372 Ok(())
373 }
373 }
374
374
375− pub async fn launch(&mut self, args: Value) -> Result<()> {
375+ pub async fn launch(&mut self, args: impl Serialize) -> Result<()> {
376− self.request("launch".to_owned(), Some(args)).await?;
376+ self.request("launch".to_owned(), to_value(args).ok())
377+ .await?;
377
378
378 match self
379 match self
379 .server_rx
380 .server_rx