Refactor types, add a Request trait

imgbot
Blaž Hrastnik 3 years ago
parent 2d1ae2e44b
commit 3a9e1c305b

@ -3,8 +3,8 @@ use crate::{
types::*, types::*,
Result, Result,
}; };
use log::{error, info}; pub use log::{error, info};
use serde::{Deserialize, Serialize}; use serde::Serialize;
use serde_json::{from_value, to_value, Value}; use serde_json::{from_value, to_value, Value};
use std::{ use std::{
collections::HashMap, collections::HashMap,
@ -208,7 +208,7 @@ impl Client {
} }
pub async fn initialize(&mut self, adapter_id: String) -> Result<()> { pub async fn initialize(&mut self, adapter_id: String) -> Result<()> {
let args = InitializeArguments { let args = requests::InitializeArguments {
client_id: Some("hx".to_owned()), client_id: Some("hx".to_owned()),
client_name: Some("helix".to_owned()), client_name: Some("helix".to_owned()),
adapter_id, adapter_id,
@ -262,7 +262,7 @@ impl Client {
file: String, file: String,
breakpoints: Vec<SourceBreakpoint>, breakpoints: Vec<SourceBreakpoint>,
) -> Result<Option<Vec<Breakpoint>>> { ) -> Result<Option<Vec<Breakpoint>>> {
let args = SetBreakpointsArguments { let args = requests::SetBreakpointsArguments {
source: Source { source: Source {
path: Some(file), path: Some(file),
name: None, name: None,
@ -280,7 +280,7 @@ impl Client {
let response = self let response = self
.request("setBreakpoints".to_owned(), to_value(args).ok()) .request("setBreakpoints".to_owned(), to_value(args).ok())
.await?; .await?;
let body: Option<SetBreakpointsResponseBody> = from_value(response.body.unwrap()).ok(); let body: Option<requests::SetBreakpointsResponse> = from_value(response.body.unwrap()).ok();
Ok(body.map(|b| b.breakpoints).unwrap()) Ok(body.map(|b| b.breakpoints).unwrap())
} }
@ -291,13 +291,13 @@ impl Client {
} }
pub async fn continue_thread(&mut self, thread_id: usize) -> Result<Option<bool>> { pub async fn continue_thread(&mut self, thread_id: usize) -> Result<Option<bool>> {
let args = ContinueArguments { thread_id }; let args = requests::ContinueArguments { thread_id };
let response = self let response = self
.request("continue".to_owned(), to_value(args).ok()) .request("continue".to_owned(), to_value(args).ok())
.await?; .await?;
let body: Option<ContinueResponseBody> = from_value(response.body.unwrap()).ok(); let body: Option<requests::ContinueResponse> = from_value(response.body.unwrap()).ok();
Ok(body.map(|b| b.all_threads_continued).unwrap()) Ok(body.map(|b| b.all_threads_continued).unwrap())
} }
@ -306,7 +306,7 @@ impl Client {
&mut self, &mut self,
thread_id: usize, thread_id: usize,
) -> Result<(Vec<StackFrame>, Option<usize>)> { ) -> Result<(Vec<StackFrame>, Option<usize>)> {
let args = StackTraceArguments { let args = requests::StackTraceArguments {
thread_id, thread_id,
start_frame: None, start_frame: None,
levels: None, levels: None,
@ -317,7 +317,7 @@ impl Client {
.request("stackTrace".to_owned(), to_value(args).ok()) .request("stackTrace".to_owned(), to_value(args).ok())
.await?; .await?;
let body: StackTraceResponseBody = from_value(response.body.unwrap()).unwrap(); let body: requests::StackTraceResponse = from_value(response.body.unwrap()).unwrap();
Ok((body.stack_frames, body.total_frames)) Ok((body.stack_frames, body.total_frames))
} }
@ -325,25 +325,25 @@ impl Client {
pub async fn threads(&mut self) -> Result<Vec<Thread>> { pub async fn threads(&mut self) -> Result<Vec<Thread>> {
let response = self.request("threads".to_owned(), None).await?; let response = self.request("threads".to_owned(), None).await?;
let body: ThreadsResponseBody = from_value(response.body.unwrap()).unwrap(); let body: requests::ThreadsResponse = from_value(response.body.unwrap()).unwrap();
Ok(body.threads) Ok(body.threads)
} }
pub async fn scopes(&mut self, frame_id: usize) -> Result<Vec<Scope>> { pub async fn scopes(&mut self, frame_id: usize) -> Result<Vec<Scope>> {
let args = ScopesArguments { frame_id }; let args = requests::ScopesArguments { frame_id };
let response = self let response = self
.request("scopes".to_owned(), to_value(args).ok()) .request("scopes".to_owned(), to_value(args).ok())
.await?; .await?;
let body: ScopesResponseBody = from_value(response.body.unwrap()).unwrap(); let body: requests::ScopesResponse = from_value(response.body.unwrap()).unwrap();
Ok(body.scopes) Ok(body.scopes)
} }
pub async fn variables(&mut self, variables_reference: usize) -> Result<Vec<Variable>> { pub async fn variables(&mut self, variables_reference: usize) -> Result<Vec<Variable>> {
let args = VariablesArguments { let args = requests::VariablesArguments {
variables_reference, variables_reference,
filter: None, filter: None,
start: None, start: None,
@ -355,7 +355,7 @@ impl Client {
.request("variables".to_owned(), to_value(args).ok()) .request("variables".to_owned(), to_value(args).ok())
.await?; .await?;
let body: VariablesResponseBody = from_value(response.body.unwrap()).unwrap(); let body: requests::VariablesResponse = from_value(response.body.unwrap()).unwrap();
Ok(body.variables) Ok(body.variables)
} }

@ -3,7 +3,7 @@ mod transport;
mod types; mod types;
pub use client::Client; pub use client::Client;
pub use transport::{Event, Payload, Request, Response, Transport}; pub use transport::{Event, Payload, Response, Transport};
pub use types::*; pub use types::*;
use thiserror::Error; use thiserror::Error;

@ -1,324 +1,392 @@
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::Value; use serde_json::Value;
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] pub trait Request {
#[serde(rename_all = "camelCase")] type Arguments: serde::de::DeserializeOwned + serde::Serialize;
pub struct ColumnDescriptor { type Result: serde::de::DeserializeOwned + serde::Serialize;
pub attribute_name: String, const COMMAND: &'static str;
pub label: String, }
pub format: Option<String>,
#[serde(rename = "type")] #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
pub col_type: Option<String>, #[serde(rename_all = "camelCase")]
pub width: Option<usize>, pub struct ColumnDescriptor {
} pub attribute_name: String,
pub label: String,
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] pub format: Option<String>,
#[serde(rename_all = "camelCase")] #[serde(rename = "type")]
pub struct ExceptionBreakpointsFilter { pub col_type: Option<String>,
pub filter: String, pub width: Option<usize>,
pub label: String, }
pub description: Option<String>,
pub default: Option<bool>, #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
pub supports_condition: Option<bool>, #[serde(rename_all = "camelCase")]
pub condition_description: Option<String>, pub struct ExceptionBreakpointsFilter {
} pub filter: String,
pub label: String,
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] pub description: Option<String>,
#[serde(rename_all = "camelCase")] pub default: Option<bool>,
pub struct DebuggerCapabilities { pub supports_condition: Option<bool>,
pub supports_configuration_done_request: Option<bool>, pub condition_description: Option<String>,
pub supports_function_breakpoints: Option<bool>, }
pub supports_conditional_breakpoints: Option<bool>,
pub supports_hit_conditional_breakpoints: Option<bool>, #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
pub supports_evaluate_for_hovers: Option<bool>, #[serde(rename_all = "camelCase")]
pub supports_step_back: Option<bool>, pub struct DebuggerCapabilities {
pub supports_set_variable: Option<bool>, pub supports_configuration_done_request: Option<bool>,
pub supports_restart_frame: Option<bool>, pub supports_function_breakpoints: Option<bool>,
pub supports_goto_targets_request: Option<bool>, pub supports_conditional_breakpoints: Option<bool>,
pub supports_step_in_targets_request: Option<bool>, pub supports_hit_conditional_breakpoints: Option<bool>,
pub supports_completions_request: Option<bool>, pub supports_evaluate_for_hovers: Option<bool>,
pub supports_modules_request: Option<bool>, pub supports_step_back: Option<bool>,
pub supports_restart_request: Option<bool>, pub supports_set_variable: Option<bool>,
pub supports_exception_options: Option<bool>, pub supports_restart_frame: Option<bool>,
pub supports_value_formatting_options: Option<bool>, pub supports_goto_targets_request: Option<bool>,
pub supports_exception_info_request: Option<bool>, pub supports_step_in_targets_request: Option<bool>,
pub support_terminate_debuggee: Option<bool>, pub supports_completions_request: Option<bool>,
pub support_suspend_debuggee: Option<bool>, pub supports_modules_request: Option<bool>,
pub supports_delayed_stack_trace_loading: Option<bool>, pub supports_restart_request: Option<bool>,
pub supports_loaded_sources_request: Option<bool>, pub supports_exception_options: Option<bool>,
pub supports_log_points: Option<bool>, pub supports_value_formatting_options: Option<bool>,
pub supports_terminate_threads_request: Option<bool>, pub supports_exception_info_request: Option<bool>,
pub supports_set_expression: Option<bool>, pub support_terminate_debuggee: Option<bool>,
pub supports_terminate_request: Option<bool>, pub support_suspend_debuggee: Option<bool>,
pub supports_data_breakpoints: Option<bool>, pub supports_delayed_stack_trace_loading: Option<bool>,
pub supports_read_memory_request: Option<bool>, pub supports_loaded_sources_request: Option<bool>,
pub supports_write_memory_request: Option<bool>, pub supports_log_points: Option<bool>,
pub supports_disassemble_request: Option<bool>, pub supports_terminate_threads_request: Option<bool>,
pub supports_cancel_request: Option<bool>, pub supports_set_expression: Option<bool>,
pub supports_breakpoint_locations_request: Option<bool>, pub supports_terminate_request: Option<bool>,
pub supports_clipboard_context: Option<bool>, pub supports_data_breakpoints: Option<bool>,
pub supports_stepping_granularity: Option<bool>, pub supports_read_memory_request: Option<bool>,
pub supports_instruction_breakpoints: Option<bool>, pub supports_write_memory_request: Option<bool>,
pub supports_exception_filter_options: Option<bool>, pub supports_disassemble_request: Option<bool>,
pub exception_breakpoint_filters: Option<Vec<ExceptionBreakpointsFilter>>, pub supports_cancel_request: Option<bool>,
pub completion_trigger_characters: Option<Vec<String>>, pub supports_breakpoint_locations_request: Option<bool>,
pub additional_module_columns: Option<Vec<ColumnDescriptor>>, pub supports_clipboard_context: Option<bool>,
pub supported_checksum_algorithms: Option<Vec<String>>, pub supports_stepping_granularity: Option<bool>,
} pub supports_instruction_breakpoints: Option<bool>,
pub supports_exception_filter_options: Option<bool>,
impl std::ops::Deref for DebuggerCapabilities { pub exception_breakpoint_filters: Option<Vec<ExceptionBreakpointsFilter>>,
type Target = Option<bool>; pub completion_trigger_characters: Option<Vec<String>>,
pub additional_module_columns: Option<Vec<ColumnDescriptor>>,
fn deref(&self) -> &Self::Target { pub supported_checksum_algorithms: Option<Vec<String>>,
&self.supports_exception_options }
}
} impl std::ops::Deref for DebuggerCapabilities {
type Target = Option<bool>;
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] fn deref(&self) -> &Self::Target {
pub struct InitializeArguments { &self.supports_exception_options
#[serde(rename = "clientID")] }
pub client_id: Option<String>, }
pub client_name: Option<String>,
#[serde(rename = "adapterID")] #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
pub adapter_id: String, #[serde(rename_all = "camelCase")]
pub locale: Option<String>, pub struct Checksum {
#[serde(rename = "linesStartAt1")] pub algorithm: String,
pub lines_start_at_one: Option<bool>, pub checksum: String,
#[serde(rename = "columnsStartAt1")] }
pub columns_start_at_one: Option<bool>,
pub path_format: Option<String>, #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
pub supports_variable_type: Option<bool>, #[serde(rename_all = "camelCase")]
pub supports_variable_paging: Option<bool>, pub struct Source {
pub supports_run_in_terminal_request: Option<bool>, pub name: Option<String>,
pub supports_memory_references: Option<bool>, pub path: Option<String>,
pub supports_progress_reporting: Option<bool>, pub source_reference: Option<usize>,
pub supports_invalidated_event: Option<bool>, pub presentation_hint: Option<String>,
} pub origin: Option<String>,
pub sources: Option<Vec<Source>>,
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] pub adapter_data: Option<Value>,
#[serde(rename_all = "camelCase")] pub checksums: Option<Vec<Checksum>>,
pub struct Checksum { }
pub algorithm: String,
pub checksum: String, #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
} #[serde(rename_all = "camelCase")]
pub struct SourceBreakpoint {
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] pub line: usize,
#[serde(rename_all = "camelCase")] pub column: Option<usize>,
pub struct Source { pub condition: Option<String>,
pub name: Option<String>, pub hit_condition: Option<String>,
pub path: Option<String>, pub log_message: Option<String>,
pub source_reference: Option<usize>, }
pub presentation_hint: Option<String>,
pub origin: Option<String>, #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
pub sources: Option<Vec<Source>>, #[serde(rename_all = "camelCase")]
pub adapter_data: Option<Value>, pub struct Breakpoint {
pub checksums: Option<Vec<Checksum>>, pub id: Option<usize>,
} pub verified: bool,
pub message: Option<String>,
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] pub source: Option<Source>,
#[serde(rename_all = "camelCase")] pub line: Option<usize>,
pub struct SourceBreakpoint { pub column: Option<usize>,
pub line: usize, pub end_line: Option<usize>,
pub column: Option<usize>, pub end_column: Option<usize>,
pub condition: Option<String>, pub instruction_reference: Option<String>,
pub hit_condition: Option<String>, pub offset: Option<usize>,
pub log_message: Option<String>, }
}
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")]
#[serde(rename_all = "camelCase")] pub struct StackFrameFormat {
pub struct SetBreakpointsArguments { pub parameters: Option<bool>,
pub source: Source, pub parameter_types: Option<bool>,
pub breakpoints: Option<Vec<SourceBreakpoint>>, pub parameter_names: Option<bool>,
// lines is deprecated pub parameter_values: Option<bool>,
pub source_modified: Option<bool>, pub line: Option<bool>,
} pub module: Option<bool>,
pub include_all: Option<bool>,
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] }
#[serde(rename_all = "camelCase")]
pub struct Breakpoint { #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
pub id: Option<usize>, #[serde(rename_all = "camelCase")]
pub verified: bool, pub struct StackFrame {
pub message: Option<String>, pub id: usize,
pub source: Option<Source>, pub name: String,
pub line: Option<usize>, pub source: Option<Source>,
pub column: Option<usize>, pub line: usize,
pub end_line: Option<usize>, pub column: usize,
pub end_column: Option<usize>, pub end_line: Option<usize>,
pub instruction_reference: Option<String>, pub end_column: Option<usize>,
pub offset: Option<usize>, pub can_restart: Option<bool>,
} pub instruction_pointer_reference: Option<String>,
pub module_id: Option<Value>,
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] pub presentation_hint: Option<String>,
#[serde(rename_all = "camelCase")] }
pub struct SetBreakpointsResponseBody {
pub breakpoints: Option<Vec<Breakpoint>>, #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
} #[serde(rename_all = "camelCase")]
pub struct Thread {
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] pub id: usize,
#[serde(rename_all = "camelCase")] pub name: String,
pub struct ContinueArguments { }
pub thread_id: usize,
} #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] pub struct Scope {
#[serde(rename_all = "camelCase")] pub name: String,
pub struct ContinueResponseBody { pub presentation_hint: Option<String>,
pub all_threads_continued: Option<bool>, pub variables_reference: usize,
} pub named_variables: Option<usize>,
pub indexed_variables: Option<usize>,
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] pub expensive: bool,
#[serde(rename_all = "camelCase")] pub source: Option<Source>,
pub struct StackFrameFormat { pub line: Option<usize>,
pub parameters: Option<bool>, pub column: Option<usize>,
pub parameter_types: Option<bool>, pub end_line: Option<usize>,
pub parameter_names: Option<bool>, pub end_column: Option<usize>,
pub parameter_values: Option<bool>, }
pub line: Option<bool>,
pub module: Option<bool>, #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
pub include_all: Option<bool>, #[serde(rename_all = "camelCase")]
} pub struct ValueFormat {
pub hex: Option<bool>,
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] }
#[serde(rename_all = "camelCase")]
pub struct StackTraceArguments { #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
pub thread_id: usize, #[serde(rename_all = "camelCase")]
pub start_frame: Option<usize>, pub struct VariablePresentationHint {
pub levels: Option<usize>, pub kind: Option<String>,
pub format: Option<StackFrameFormat>, pub attributes: Option<Vec<String>>,
} pub visibility: Option<String>,
}
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
pub struct StackFrame { #[serde(rename_all = "camelCase")]
pub id: usize, pub struct Variable {
pub name: String, pub name: String,
pub source: Option<Source>, pub value: String,
pub line: usize, #[serde(rename = "type")]
pub column: usize, pub data_type: Option<String>,
pub end_line: Option<usize>, pub presentation_hint: Option<VariablePresentationHint>,
pub end_column: Option<usize>, pub evaluate_name: Option<String>,
pub can_restart: Option<bool>, pub variables_reference: usize,
pub instruction_pointer_reference: Option<String>, pub named_variables: Option<usize>,
pub module_id: Option<Value>, pub indexed_variables: Option<usize>,
pub presentation_hint: Option<String>, pub memory_reference: Option<String>,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] pub mod requests {
#[serde(rename_all = "camelCase")] use super::*;
pub struct StackTraceResponseBody { #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
pub total_frames: Option<usize>, #[serde(rename_all = "camelCase")]
pub stack_frames: Vec<StackFrame>, pub struct InitializeArguments {
} #[serde(rename = "clientID")]
pub client_id: Option<String>,
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] pub client_name: Option<String>,
#[serde(rename_all = "camelCase")] #[serde(rename = "adapterID")]
pub struct Thread { pub adapter_id: String,
pub id: usize, pub locale: Option<String>,
pub name: String, #[serde(rename = "linesStartAt1")]
} pub lines_start_at_one: Option<bool>,
#[serde(rename = "columnsStartAt1")]
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] pub columns_start_at_one: Option<bool>,
#[serde(rename_all = "camelCase")] pub path_format: Option<String>,
pub struct ThreadsResponseBody { pub supports_variable_type: Option<bool>,
pub threads: Vec<Thread>, pub supports_variable_paging: Option<bool>,
} pub supports_run_in_terminal_request: Option<bool>,
pub supports_memory_references: Option<bool>,
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] pub supports_progress_reporting: Option<bool>,
#[serde(rename_all = "camelCase")] pub supports_invalidated_event: Option<bool>,
pub struct ScopesArguments { }
pub frame_id: usize,
} #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] pub struct SetBreakpointsArguments {
#[serde(rename_all = "camelCase")] pub source: Source,
pub struct Scope { pub breakpoints: Option<Vec<SourceBreakpoint>>,
pub name: String, // lines is deprecated
pub presentation_hint: Option<String>, pub source_modified: Option<bool>,
pub variables_reference: usize, }
pub named_variables: Option<usize>,
pub indexed_variables: Option<usize>, #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
pub expensive: bool, #[serde(rename_all = "camelCase")]
pub source: Option<Source>, pub struct SetBreakpointsResponse {
pub line: Option<usize>, pub breakpoints: Option<Vec<Breakpoint>>,
pub column: Option<usize>, }
pub end_line: Option<usize>,
pub end_column: Option<usize>, #[derive(Debug)]
} pub enum SetBreakpoints {}
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] impl Request for SetBreakpoints {
#[serde(rename_all = "camelCase")] type Arguments = SetBreakpointsArguments;
pub struct ScopesResponseBody { type Result = SetBreakpointsResponse;
pub scopes: Vec<Scope>, const COMMAND: &'static str = "setBreakpoints";
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ValueFormat { pub struct ContinueArguments {
pub hex: Option<bool>, pub thread_id: usize,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct VariablesArguments { pub struct ContinueResponse {
pub variables_reference: usize, pub all_threads_continued: Option<bool>,
pub filter: Option<String>, }
pub start: Option<usize>,
pub count: Option<usize>, #[derive(Debug)]
pub format: Option<ValueFormat>, pub enum Continue {}
}
impl Request for Continue {
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] type Arguments = ContinueArguments;
#[serde(rename_all = "camelCase")] type Result = ContinueResponse;
pub struct VariablePresentationHint { const COMMAND: &'static str = "continue";
pub kind: Option<String>, }
pub attributes: Option<Vec<String>>,
pub visibility: Option<String>, #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
} #[serde(rename_all = "camelCase")]
pub struct StackTraceArguments {
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] pub thread_id: usize,
#[serde(rename_all = "camelCase")] pub start_frame: Option<usize>,
pub struct Variable { pub levels: Option<usize>,
pub name: String, pub format: Option<StackFrameFormat>,
pub value: String, }
#[serde(rename = "type")]
pub data_type: Option<String>, #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
pub presentation_hint: Option<VariablePresentationHint>, #[serde(rename_all = "camelCase")]
pub evaluate_name: Option<String>, pub struct StackTraceResponse {
pub variables_reference: usize, pub total_frames: Option<usize>,
pub named_variables: Option<usize>, pub stack_frames: Vec<StackFrame>,
pub indexed_variables: Option<usize>, }
pub memory_reference: Option<String>,
} #[derive(Debug)]
pub enum StackTrace {}
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] impl Request for StackTrace {
pub struct VariablesResponseBody { type Arguments = StackTraceArguments;
pub variables: Vec<Variable>, type Result = StackTraceResponse;
} const COMMAND: &'static str = "stackTrace";
}
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
pub struct OutputEventBody { #[serde(rename_all = "camelCase")]
pub output: String, pub struct ThreadsResponse {
pub category: Option<String>, pub threads: Vec<Thread>,
pub group: Option<String>, }
pub line: Option<usize>,
pub column: Option<usize>, #[derive(Debug)]
pub variables_reference: Option<usize>, pub enum Threads {}
pub source: Option<Source>,
pub data: Option<Value>, impl Request for Threads {
} type Arguments = ();
type Result = ThreadsResponse;
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] const COMMAND: &'static str = "threads";
#[serde(rename_all = "camelCase")] }
pub struct StoppedEventBody {
pub reason: String, #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
pub description: Option<String>, #[serde(rename_all = "camelCase")]
pub thread_id: Option<usize>, pub struct ScopesArguments {
pub preserve_focus_hint: Option<bool>, pub frame_id: usize,
pub text: Option<String>, }
pub all_threads_stopped: Option<bool>,
pub hit_breakpoint_ids: Option<Vec<usize>>, #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
} #[serde(rename_all = "camelCase")]
pub struct ScopesResponse {
pub scopes: Vec<Scope>,
}
#[derive(Debug)]
pub enum Scopes {}
impl Request for Scopes {
type Arguments = ScopesArguments;
type Result = ScopesResponse;
const COMMAND: &'static str = "scopes";
}
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct VariablesArguments {
pub variables_reference: usize,
pub filter: Option<String>,
pub start: Option<usize>,
pub count: Option<usize>,
pub format: Option<ValueFormat>,
}
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct VariablesResponse {
pub variables: Vec<Variable>,
}
#[derive(Debug)]
pub enum Variables {}
impl Request for Variables {
type Arguments = VariablesArguments;
type Result = VariablesResponse;
const COMMAND: &'static str = "scopes";
}
}
// Events
pub mod events {
use super::*;
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Output {
pub output: String,
pub category: Option<String>,
pub group: Option<String>,
pub line: Option<usize>,
pub column: Option<usize>,
pub variables_reference: Option<usize>,
pub source: Option<Source>,
pub data: Option<Value>,
}
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Stopped {
pub reason: String,
pub description: Option<String>,
pub thread_id: Option<usize>,
pub preserve_focus_hint: Option<bool>,
pub text: Option<String>,
pub all_threads_stopped: Option<bool>,
pub hit_breakpoint_ids: Option<Vec<usize>>,
}
}

Loading…
Cancel
Save