on master help sign in
types: simplify working with client's launch args
commitaac586b5464fef5f850d9c80bc3c9467e255977d authorDmitry Sharshakov <d3dx12.xx@gmail.com> dateFri 13 Aug 2021, 20:33 (5 years ago) parent6bb653f
2 files changed+4−6
helix-dap/examples/dap-basic.rs+1−4 helix-dap/src/client.rs+3−2
helix-dap/examples/dap-basic.rs+1−4
@@ -33,10 +33,7 @@ pub async fn main() -> Result<()> {
3333 program: "/tmp/godebug/main".to_owned(),
3434 };
3535
36− println!(
37− "launch: {:?}",
38− client.launch(serde_json::to_value(args)?).await
39− );
36+ println!("launch: {:?}", client.launch(args).await);
4037
4138 println!(
4239 "breakpoints: {:#?}",
helix-dap/src/client.rs+3−2
@@ -372,8 +372,9 @@ impl Client {
372372 Ok(())
373373 }
374374
375− pub async fn launch(&mut self, args: Value) -> Result<()> {
376− self.request("launch".to_owned(), Some(args)).await?;
375+ pub async fn launch(&mut self, args: impl Serialize) -> Result<()> {
376+ self.request("launch".to_owned(), to_value(args).ok())
377+ .await?;
377378
378379 match self
379380 .server_rx