types: simplify working with client's launch args

This commit is contained in:
Dmitry Sharshakov 2021-08-13 20:33:07 +03:00 committed by Blaž Hrastnik
parent 6bb653f820
commit aac586b546
2 changed files with 4 additions and 6 deletions

View File

@ -33,10 +33,7 @@ pub async fn main() -> Result<()> {
program: "/tmp/godebug/main".to_owned(),
};
println!(
"launch: {:?}",
client.launch(serde_json::to_value(args)?).await
);
println!("launch: {:?}", client.launch(args).await);
println!(
"breakpoints: {:#?}",

View File

@ -372,8 +372,9 @@ pub async fn disconnect(&mut self) -> Result<()> {
Ok(())
}
pub async fn launch(&mut self, args: Value) -> Result<()> {
self.request("launch".to_owned(), Some(args)).await?;
pub async fn launch(&mut self, args: impl Serialize) -> Result<()> {
self.request("launch".to_owned(), to_value(args).ok())
.await?;
match self
.server_rx