jdwp_client/lib.rs
1// Lint policy — mirror the rust-doctor health gate (see `.github/workflows/`)
2// locally so `cargo clippy` surfaces exactly what CI does. rust-doctor enables
3// clippy's pedantic/nursery/cargo groups plus a curated set of restriction
4// lints via command-line flags; declaring them here keeps the two in sync.
5#![warn(clippy::pedantic, clippy::nursery)]
6#![warn(
7 clippy::unwrap_used,
8 clippy::expect_used,
9 clippy::indexing_slicing,
10 clippy::format_push_string,
11 clippy::panic_in_result_fn
12)]
13// Restriction lints above target production code; unit tests may panic on failure, so `unwrap`,
14// `expect`, indexing, and assertions are idiomatic there.
15#![cfg_attr(
16 test,
17 allow(clippy::unwrap_used, clippy::expect_used, clippy::indexing_slicing, clippy::panic_in_result_fn)
18)]
19//! A JDWP (Java Debug Wire Protocol) client — the transport and command layer behind the `jdwp-mcp`
20//! debugging server.
21//!
22//! Implements the subset of JDWP that practical debugging needs: connection management, breakpoint and
23//! event-request operations, stack and variable inspection, expression evaluation, and execution control.
24//!
25//! # This is not a supported public API
26//!
27//! **The crate is published because `jdwp-mcp` depends on it, and for no other reason.** `cargo publish`
28//! rejects a bare path dependency, so a binary on crates.io requires its library to be there too; that
29//! requirement is the whole story of this listing.
30//!
31//! What follows from that, and it is worth reading before you build on this:
32//!
33//! - **The surface is shaped for one consumer.** These modules are the seams `jdwp-mcp` needed, exposed
34//! where it needed them. They are not a curated library API, and several are public only because a
35//! sibling module had to reach them.
36//! - **Anything here may change in any release**, including a patch one. The version gate in this
37//! repository exists to keep the *version number* honest about what changed, not to promise that
38//! nothing will.
39//! - **Nothing here is deprecated before it is removed**, because there is no deprecation cycle to run.
40//!
41//! None of that means it will not work — it is the code a real debugger runs against real JVMs, and it
42//! is tested against JDK 11, 17 and 21. It means the cost of a break lands on you rather than on us, and
43//! that pinning an exact version is the only safe way to depend on it.
44//!
45//! If you want the debugger rather than the protocol layer, install `jdwp-mcp`.
46//!
47//! # Where the documentation is
48//!
49//! The narrative lives on the items themselves rather than here. The design decisions behind them are in
50//! the repository's `docs/adr/`, and `CONTEXT.md` is the glossary for the vocabulary these types use —
51//! *stop point*, *trace*, *snapshot*, *hit* and *suspension* all have precise meanings that are not
52//! guessable from the type names.
53
54pub mod commands;
55pub mod connection;
56pub mod eval;
57pub mod eventloop;
58pub mod eventrequest;
59pub mod events;
60pub mod extra;
61pub mod method;
62pub mod object;
63pub mod protocol;
64pub mod reader;
65pub mod reftype;
66pub mod stackframe;
67pub mod string;
68pub mod thread;
69pub mod types;
70pub mod vm;
71
72pub use connection::{JdwpConnection, MAX_READS_IN_FLIGHT};
73pub use eventloop::{spawn_event_loop, EventLoopHandle};
74pub use eventrequest::{EventFilters, MonitorKind, SuspendPolicy, WatchKind};
75pub use events::EventSet;
76pub use protocol::{JdwpError, JdwpResult};
77
78#[cfg(test)]
79mod tests {
80 #[test]
81 fn it_works() {
82 assert_eq!(2 + 2, 4);
83 }
84}