{"id":22007656,"url":"https://github.com/sztomi/dap-rs","last_synced_at":"2025-04-10T00:18:12.427Z","repository":{"id":63130010,"uuid":"555336108","full_name":"sztomi/dap-rs","owner":"sztomi","description":"A Rust implementation of the Debug Adapter Protocol","archived":false,"fork":false,"pushed_at":"2024-04-16T16:24:21.000Z","size":189,"stargazers_count":55,"open_issues_count":6,"forks_count":11,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-10T00:18:03.223Z","etag":null,"topics":["debugging","debugging-tool","framework","protocol"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sztomi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.Apache2.0","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-21T11:34:12.000Z","updated_at":"2025-03-07T13:40:14.000Z","dependencies_parsed_at":"2024-11-30T01:28:50.490Z","dependency_job_id":"6a51c648-86b7-472b-87dc-cf1a01e728a8","html_url":"https://github.com/sztomi/dap-rs","commit_stats":{"total_commits":47,"total_committers":2,"mean_commits":23.5,"dds":"0.021276595744680882","last_synced_commit":"117cdaf5814fe98bfd22627adaecf50063f98d47"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sztomi%2Fdap-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sztomi%2Fdap-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sztomi%2Fdap-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sztomi%2Fdap-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sztomi","download_url":"https://codeload.github.com/sztomi/dap-rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248131318,"owners_count":21052820,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["debugging","debugging-tool","framework","protocol"],"created_at":"2024-11-30T01:28:41.934Z","updated_at":"2025-04-10T00:18:12.399Z","avatar_url":"https://github.com/sztomi.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dap-rs, a Rust implementation of the Debug Adapter Protocol\n\n## Introduction\n\nThis crate is a Rust implementation of the [Debug Adapter Protocol][1] (or DAP for short).\n\nThe best way to think of DAP is to compare it to [LSP][2] (Language Server Protocol) but\nfor debuggers. The core idea is the same: a protocol that serves as *lingua franca*\nfor editors and debuggers to talk to each other. This means that an editor that implements\nDAP can use a debugger that also implements DAP.\n\nIn practice, the adapter might be separate from the actual debugger. For example, one could\nimplement an adapter that writes commands to the stdin of a gdb subprocess, then parses\nthe output it receives (this is why it's called an \"adapter\" - it adapts the debugger to\neditors that know DAP).\n\n## Stability\n\nThis crate is in a fairly early stage and breakages will be frequent. Any version before\n1.0 might be a breaking version.\n\n## Minimal example\n\nTo get started, create a binary project and add `dap` to your Cargo.toml:\n\n```toml\n[package]\nname = \"dummy-server\"\nversion = \"*\"\nedition = \"2021\"\n\n[dependencies]\ndap = \"*\"\n```\n\nOur dummy server is going to read its input from a text file and write the output to stdout.\n\n```rust\nuse std::fs::File;\nuse std::io::{BufReader, BufWriter};\n\nuse thiserror::Error;\n\nuse dap::prelude::*;\n\n#[derive(Error, Debug)]\nenum MyAdapterError {\n  #[error(\"Unhandled command\")]\n  UnhandledCommandError,\n\n  #[error(\"Missing command\")]\n  MissingCommandError,\n}\n\ntype DynResult\u003cT\u003e = std::result::Result\u003cT, Box\u003cdyn std::error::Error\u003e\u003e;\n\nfn main() -\u003e DynResult\u003c()\u003e {\n  let output = BufWriter::new(std::io::stdout());\n  let f = File::open(\"testinput.txt\")?;\n  let input = BufReader::new(f);\n  let mut server = Server::new(input, output);\n\n  let req = match server.poll_request()? {\n    Some(req) =\u003e req,\n    None =\u003e return Err(Box::new(MyAdapterError::MissingCommandError)),\n  };\n  if let Command::Initialize(_) = req.command {\n    let rsp = req.success(\n      ResponseBody::Initialize(Some(types::Capabilities {\n        ..Default::default()\n      })),\n    );\n\n    // When you call respond, send_event etc. the message will be wrapped\n    // in a base message with a appropriate seq number, so you don't have to keep track of that yourself\n    server.respond(rsp)?;\n\n    server.send_event(Event::Initialized)?;\n  } else {\n    return Err(Box::new(MyAdapterError::UnhandledCommandError));\n  }\n  Ok(())\n}\n```\n\n## License\n\nThis library is dual-licensed as MIT and Apache 2.0. That means users may choose either of these\nlicenses. In general, these are non-restrictive, non-viral licenses, a.k.a. *\"do what you want\nbut no guarantees from me\"*.\n\nCommercial support is available on a contract basis (contact me: szelei.t@gmail.com).\n\n[1]: https://microsoft.github.io/debug-adapter-protocol/\n[2]: https://microsoft.github.io/language-server-protocol/\n[3]: https://microsoft.github.io/debug-adapter-protocol/specification#Requests","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsztomi%2Fdap-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsztomi%2Fdap-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsztomi%2Fdap-rs/lists"}