aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Sharshakov2021-08-22 09:13:43 +0000
committerDmitry Sharshakov2021-08-22 09:13:43 +0000
commit74102bfc6da7cbb49ef383dddc5f789c270663a4 (patch)
tree6e48f91408702b8f2b6ad490e257f85aa0262776
parentd0b0c9b2ef1f26dbf7e5addf59d73b9634907af2 (diff)
examples: fix build
-rw-r--r--helix-dap/examples/dap-dlv.rs33
-rw-r--r--helix-dap/examples/dap-lldb.rs33
2 files changed, 30 insertions, 36 deletions
diff --git a/helix-dap/examples/dap-dlv.rs b/helix-dap/examples/dap-dlv.rs
index 5db5fa84..eecc4318 100644
--- a/helix-dap/examples/dap-dlv.rs
+++ b/helix-dap/examples/dap-dlv.rs
@@ -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_json::{from_value, to_value};
+use serde_json::to_value;
use tokio::sync::mpsc::UnboundedReceiver;
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
@@ -13,22 +13,19 @@ struct LaunchArguments {
async fn dispatch(mut rx: UnboundedReceiver<Payload>) {
loop {
match rx.recv().await.unwrap() {
- Payload::Event(ev) => match &ev.event[..] {
- "output" => {
- let body: events::Output = from_value(ev.body.unwrap()).unwrap();
- println!(
- "> [{}] {}",
- body.category.unwrap_or("unknown".to_owned()),
- body.output
- );
- }
- "stopped" => {
- println!("stopped");
- }
- _ => {}
- },
- Payload::Response(_) => unreachable!(),
- Payload::Request(_) => todo!(),
+ Payload::Event(Event::Output(events::Output {
+ category, output, ..
+ })) => {
+ println!(
+ "> [{}] {}",
+ category.unwrap_or("unknown".to_owned()),
+ output
+ );
+ }
+ Payload::Event(Event::Stopped(_)) => {
+ println!("stopped");
+ }
+ _ => {}
};
}
}
diff --git a/helix-dap/examples/dap-lldb.rs b/helix-dap/examples/dap-lldb.rs
index 89f74b22..2adef8b2 100644
--- a/helix-dap/examples/dap-lldb.rs
+++ b/helix-dap/examples/dap-lldb.rs
@@ -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_json::{from_value, to_value};
+use serde_json::to_value;
use tokio::sync::mpsc::UnboundedReceiver;
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
@@ -13,22 +13,19 @@ struct LaunchArguments {
async fn dispatch(mut rx: UnboundedReceiver<Payload>) {
loop {
match rx.recv().await.unwrap() {
- Payload::Event(ev) => match &ev.event[..] {
- "output" => {
- let body: events::Output = from_value(ev.body.unwrap()).unwrap();
- println!(
- "> [{}] {}",
- body.category.unwrap_or("unknown".to_owned()),
- body.output
- );
- }
- "stopped" => {
- println!("stopped");
- }
- _ => {}
- },
- Payload::Response(_) => unreachable!(),
- Payload::Request(_) => todo!(),
+ Payload::Event(Event::Output(events::Output {
+ category, output, ..
+ })) => {
+ println!(
+ "> [{}] {}",
+ category.unwrap_or("unknown".to_owned()),
+ output
+ );
+ }
+ Payload::Event(Event::Stopped(_)) => {
+ println!("stopped");
+ }
+ _ => {}
};
}
}