Skip to content

Commit

Permalink
add Clone and Default for applicable responses
Browse files Browse the repository at this point in the history
  • Loading branch information
pileghoff authored and sztomi committed Jun 27, 2023
1 parent 4ba05fd commit c0f5cf7
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions src/responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
};

/// Represents a response message that is either a cancellation or a short error string.
#[derive(Serialize, Debug)]
#[derive(Serialize, Debug, Clone)]
pub enum ResponseMessage {
/// Should be sent when the request was canceled
Cancelled,
Expand All @@ -20,27 +20,27 @@ pub enum ResponseMessage {
Error(String),
}

#[derive(Serialize, Debug)]
#[derive(Serialize, Debug, Default, Clone)]
pub struct BreakpointLocationsResponse {
/// Sorted set of possible breakpoint locations.
pub breakpoints: Vec<BreakpointLocation>,
}

#[derive(Serialize, Debug)]
#[derive(Serialize, Debug, Default, Clone)]
pub struct CompletionsResponse {
/// The possible completions
pub targets: Vec<CompletionItem>,
}

#[derive(Serialize, Debug)]
#[derive(Serialize, Debug, Default, Clone)]
pub struct ContinueResponse {
/// The value true (or a missing property) signals to the client that all
/// threads have been resumed. The value false indicates that not all threads
/// were resumed.
pub all_threads_continued: Option<bool>,
}

#[derive(Serialize, Debug)]
#[derive(Serialize, Debug, Default, Clone)]
pub struct DataBreakpointInfoResponse {
/// An identifier for the data on which a data breakpoint can be registered
/// with the `setDataBreakpoints` request or null if no data breakpoint is
Expand All @@ -57,13 +57,13 @@ pub struct DataBreakpointInfoResponse {
pub can_persist: Option<bool>,
}

#[derive(Serialize, Debug)]
#[derive(Serialize, Debug, Default, Clone)]
pub struct DisassembleResponse {
/// The list of disassembled instructions.
pub instructions: Vec<DisassembledInstruction>,
}

#[derive(Serialize, Debug)]
#[derive(Serialize, Debug, Default, Clone)]
#[serde(rename_all = "camelCase")]
pub struct EvaluateResponse {
/// The result of the evaluate request.
Expand Down Expand Up @@ -99,7 +99,7 @@ pub struct EvaluateResponse {
pub memory_reference: Option<String>,
}

#[derive(Serialize, Debug)]
#[derive(Serialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ExceptionInfoResponse {
/// ID of the exception that was thrown.
Expand All @@ -112,21 +112,21 @@ pub struct ExceptionInfoResponse {
pub details: Option<ExceptionDetails>,
}

#[derive(Serialize, Debug)]
#[derive(Serialize, Debug, Default, Clone)]
#[serde(rename_all = "camelCase")]
pub struct GotoTargetsResponse {
/// The possible goto targets of the specified location.
pub targets: Vec<GotoTarget>,
}

#[derive(Serialize, Debug)]
#[derive(Serialize, Debug, Default, Clone)]
#[serde(rename_all = "camelCase")]
pub struct LoadedSourcesResponse {
/// Set of loaded sources.
pub sources: Vec<Source>,
}

#[derive(Serialize, Debug)]
#[derive(Serialize, Debug, Default, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ModulesResponse {
/// All modules or range of modules.
Expand All @@ -135,7 +135,7 @@ pub struct ModulesResponse {
pub total_modules: Option<i64>,
}

#[derive(Serialize, Debug)]
#[derive(Serialize, Debug, Default, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ReadMemoryResponse {
/// The address of the first byte of data returned.
Expand All @@ -151,15 +151,15 @@ pub struct ReadMemoryResponse {
pub data: Option<String>,
}

#[derive(Serialize, Debug)]
#[derive(Serialize, Debug, Default, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ScopesResponse {
/// The scopes of the stackframe. If the array has length zero, there are no
/// scopes available.
pub scopes: Vec<Scope>,
}

#[derive(Serialize, Debug)]
#[derive(Serialize, Debug, Default, Clone)]
#[serde(rename_all = "camelCase")]
pub struct SetBreakpointsResponse {
/// Information about the breakpoints.
Expand All @@ -168,7 +168,7 @@ pub struct SetBreakpointsResponse {
pub breakpoints: Vec<Breakpoint>,
}

#[derive(Serialize, Debug)]
#[derive(Serialize, Debug, Default, Clone)]
#[serde(rename_all = "camelCase")]
pub struct SetDataBreakpointsResponse {
/// Information about the breakpoints.
Expand All @@ -177,7 +177,7 @@ pub struct SetDataBreakpointsResponse {
pub breakpoints: Vec<Breakpoint>,
}

#[derive(Serialize, Debug)]
#[derive(Serialize, Debug, Default, Clone)]
#[serde(rename_all = "camelCase")]
pub struct SetExceptionBreakpointsResponse {
/// Information about the exception breakpoints or filters.
Expand All @@ -189,23 +189,23 @@ pub struct SetExceptionBreakpointsResponse {
pub breakpoints: Option<Vec<Breakpoint>>,
}

#[derive(Serialize, Debug)]
#[derive(Serialize, Debug, Default, Clone)]
#[serde(rename_all = "camelCase")]
pub struct SetFunctionBreakpointsResponse {
/// Information about the breakpoints. The array elements correspond to the
/// elements of the `breakpoints` array.
pub breakpoints: Vec<Breakpoint>,
}

#[derive(Serialize, Debug)]
#[derive(Serialize, Debug, Default, Clone)]
#[serde(rename_all = "camelCase")]
pub struct SetInstructionBreakpointsResponse {
/// Information about the breakpoints. The array elements correspond to the
/// elements of the `breakpoints` array.
pub breakpoints: Vec<Breakpoint>,
}

#[derive(Serialize, Debug)]
#[derive(Serialize, Debug, Default, Clone)]
#[serde(rename_all = "camelCase")]
pub struct SetVariableResponse {
/// The new value of the variable.
Expand All @@ -231,7 +231,7 @@ pub struct SetVariableResponse {
pub indexed_variables: Option<i64>,
}

#[derive(Serialize, Debug)]
#[derive(Serialize, Debug, Default, Clone)]
#[serde(rename_all = "camelCase")]
pub struct SourceResponse {
/// Content of the source reference.
Expand All @@ -240,7 +240,7 @@ pub struct SourceResponse {
pub mime_type: Option<String>,
}

#[derive(Serialize, Debug)]
#[derive(Serialize, Debug, Default, Clone)]
#[serde(rename_all = "camelCase")]
pub struct SetExpressionResponse {
/// The new value of the expression.
Expand Down Expand Up @@ -270,7 +270,7 @@ pub struct SetExpressionResponse {
pub indexed_variables: Option<i64>,
}

#[derive(Serialize, Debug)]
#[derive(Serialize, Debug, Default, Clone)]
#[serde(rename_all = "camelCase")]
pub struct StackTraceResponse {
/// The frames of the stackframe. If the array has length zero, there are no
Expand All @@ -286,21 +286,21 @@ pub struct StackTraceResponse {
pub total_frames: Option<i64>,
}

#[derive(Serialize, Debug)]
#[derive(Serialize, Debug, Default, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ThreadsResponse {
/// All threads.
pub threads: Vec<Thread>,
}

#[derive(Serialize, Debug)]
#[derive(Serialize, Debug, Default, Clone)]
#[serde(rename_all = "camelCase")]
pub struct VariablesResponse {
/// All (or a range) of variables for the given variable reference.
pub variables: Vec<Variable>,
}

#[derive(Serialize, Debug)]
#[derive(Serialize, Debug, Default, Clone)]
#[serde(rename_all = "camelCase")]
pub struct WriteMemoryResponse {
/// Property that should be returned when `allowPartial` is true to indicate
Expand All @@ -312,7 +312,7 @@ pub struct WriteMemoryResponse {
pub bytes_written: Option<i64>,
}

#[derive(Serialize, Debug)]
#[derive(Serialize, Debug, Clone)]
#[serde(tag = "command", content = "body", rename_all = "camelCase")]
pub enum ResponseBody {
/// Response to attach request. This is just an acknowledgement, so no body field is required.
Expand Down Expand Up @@ -521,7 +521,7 @@ pub enum ResponseBody {
/// ResponseBody enum.
///
/// Specification: [Response](https://microsoft.github.io/debug-adapter-protocol/specification#Base_Protocol_Response)
#[derive(Serialize, Debug)]
#[derive(Serialize, Debug, Default, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Response {
/// Sequence number of the corresponding request.
Expand Down

0 comments on commit c0f5cf7

Please sign in to comment.