on master help sign in
examples: continue handling output events
6c0f7eaDmitry Sharshakov
helix-dap/examples/dap-dlv.rs+9−7
@@ -11,13 +11,15 @@ struct LaunchArguments {
11}
11}
12
12
13async fn output(mut output_event: Receiver<Event>) {
13async fn output(mut output_event: Receiver<Event>) {
14+ loop {
14− let body: OutputEventBody =
15+ let body: OutputEventBody =
15− from_value(output_event.recv().await.unwrap().body.unwrap()).unwrap();
16+ from_value(output_event.recv().await.unwrap().body.unwrap()).unwrap();
16− println!(
17+ println!(
17− "> [{}] {}",
18+ "> [{}] {}",
18− body.category.unwrap_or("unknown".to_owned()),
19+ body.category.unwrap_or("unknown".to_owned()),
19− body.output
20+ body.output
20− );
21+ );
22+ }
21}
23}
22
24
23#[tokio::main]
25#[tokio::main]
helix-dap/examples/dap-lldb.rs+9−7
@@ -11,13 +11,15 @@ struct LaunchArguments {
11}
11}
12
12
13async fn output(mut output_event: Receiver<Event>) {
13async fn output(mut output_event: Receiver<Event>) {
14+ loop {
14− let body: OutputEventBody =
15+ let body: OutputEventBody =
15− from_value(output_event.recv().await.unwrap().body.unwrap()).unwrap();
16+ from_value(output_event.recv().await.unwrap().body.unwrap()).unwrap();
16− println!(
17+ println!(
17− "> [{}] {}",
18+ "> [{}] {}",
18− body.category.unwrap_or("unknown".to_owned()),
19+ body.category.unwrap_or("unknown".to_owned()),
19− body.output
20+ body.output
20− );
21+ );
22+ }
21}
23}
22
24
23#[tokio::main]
25#[tokio::main]