examples: fix build
This commit is contained in:
parent
d0b0c9b2ef
commit
74102bfc6d
2 changed files with 30 additions and 36 deletions
|
@ -1,6 +1,6 @@
|
||||||
use helix_dap::{events, Client, Payload, Result, SourceBreakpoint};
|
use helix_dap::{events, Client, Event, Payload, Result, SourceBreakpoint};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::{from_value, to_value};
|
use serde_json::to_value;
|
||||||
use tokio::sync::mpsc::UnboundedReceiver;
|
use tokio::sync::mpsc::UnboundedReceiver;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
||||||
|
@ -13,22 +13,19 @@ struct LaunchArguments {
|
||||||
async fn dispatch(mut rx: UnboundedReceiver<Payload>) {
|
async fn dispatch(mut rx: UnboundedReceiver<Payload>) {
|
||||||
loop {
|
loop {
|
||||||
match rx.recv().await.unwrap() {
|
match rx.recv().await.unwrap() {
|
||||||
Payload::Event(ev) => match &ev.event[..] {
|
Payload::Event(Event::Output(events::Output {
|
||||||
"output" => {
|
category, output, ..
|
||||||
let body: events::Output = from_value(ev.body.unwrap()).unwrap();
|
})) => {
|
||||||
println!(
|
println!(
|
||||||
"> [{}] {}",
|
"> [{}] {}",
|
||||||
body.category.unwrap_or("unknown".to_owned()),
|
category.unwrap_or("unknown".to_owned()),
|
||||||
body.output
|
output
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
"stopped" => {
|
Payload::Event(Event::Stopped(_)) => {
|
||||||
println!("stopped");
|
println!("stopped");
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
},
|
|
||||||
Payload::Response(_) => unreachable!(),
|
|
||||||
Payload::Request(_) => todo!(),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use helix_dap::{events, Client, Payload, Result, SourceBreakpoint};
|
use helix_dap::{events, Client, Event, Payload, Result, SourceBreakpoint};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::{from_value, to_value};
|
use serde_json::to_value;
|
||||||
use tokio::sync::mpsc::UnboundedReceiver;
|
use tokio::sync::mpsc::UnboundedReceiver;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
||||||
|
@ -13,22 +13,19 @@ struct LaunchArguments {
|
||||||
async fn dispatch(mut rx: UnboundedReceiver<Payload>) {
|
async fn dispatch(mut rx: UnboundedReceiver<Payload>) {
|
||||||
loop {
|
loop {
|
||||||
match rx.recv().await.unwrap() {
|
match rx.recv().await.unwrap() {
|
||||||
Payload::Event(ev) => match &ev.event[..] {
|
Payload::Event(Event::Output(events::Output {
|
||||||
"output" => {
|
category, output, ..
|
||||||
let body: events::Output = from_value(ev.body.unwrap()).unwrap();
|
})) => {
|
||||||
println!(
|
println!(
|
||||||
"> [{}] {}",
|
"> [{}] {}",
|
||||||
body.category.unwrap_or("unknown".to_owned()),
|
category.unwrap_or("unknown".to_owned()),
|
||||||
body.output
|
output
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
"stopped" => {
|
Payload::Event(Event::Stopped(_)) => {
|
||||||
println!("stopped");
|
println!("stopped");
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
},
|
|
||||||
Payload::Response(_) => unreachable!(),
|
|
||||||
Payload::Request(_) => todo!(),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue