1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! `qmp` - Async-first QEMU/QMP client library.
//!
//! This crate is designed for:
//! - QEMU QMP sockets (Unix / TCP)
//! - PVE / Proxmox scenarios where you want observability and automation
//! without invasive changes
//!
//! It provides:
//! - socket connection management (Unix/TCP)
//! - handshake + `qmp_capabilities` negotiation
//! - typed JSON (serde) request/response handling
//! - subscribable event stream
//! - per-call timeout and cooperative cancellation
//! - an optional "safe ops" layer with allow-lists, idempotency, mutex, and retry/backoff
//!
//! ## Quick start (Unix socket)
//!
//! ```no_run
//! use qmp::{Client, Endpoint};
//! # async fn demo() -> qmp::Result<()> {
//! let client = Client::connect(Endpoint::unix("/var/run/qemu-server/100.qmp")).await?;
//!
//! // Low-level (generic) call:
//! let status: serde_json::Value = client.execute("query-status", Option::<()>::None).await?;
//! println!("status = {status}");
//!
//! // Subscribe to events:
//! let mut events = client.events();
//! if let Ok(ev) = events.recv().await {
//! println!("event: {}", ev.name);
//! }
//! # Ok(()) }
//! ```
pub use CancelToken;
pub use ;
pub use ;
pub use EventStream;