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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//! The connection a kevy-cli tool talks through.
//!
//! A tool needs two things from a server: one request and its reply, and a
//! pre-encoded batch with its replies. Both connections kevy-cli has
//! provide them — [`RespClient`] (plain TCP, what the tools grew up on) and
//! the redis-cli half's connection, which also authenticates, speaks unix
//! sockets and URIs, and selects a database. Tools take `&mut dyn Link`, so
//! `kevy-cli --kevy <tool>` runs them on the same connection every other
//! command uses.
//!
//! ```
//! use kevy_cli::link::Link;
//! # let port = include!(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/doc_server/serve.rs"));
//! let mut client = kevy_resp_client::RespClient::connect("127.0.0.1", port)?;
//! kevy_cli::doctor::run(&mut client, kevy_cli::doctor::OnWarning::Report)?;
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```
use ;
use io;
/// A request/reply connection to a RESP server.
///
/// Sealed: implemented by [`RespClient`] and by kevy-cli's own redis-cli
/// connection, the two connections the tools are written against.
///
/// ```
/// use kevy_cli::link::Link;
/// # let port = include!(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/doc_server/serve.rs"));
/// let mut client = kevy_resp_client::RespClient::connect("127.0.0.1", port)?;
/// let link: &mut dyn Link = &mut client;
/// let pong = link.request_borrowed(&[b"PING"])?;
/// assert_eq!(pong, kevy_resp_client::Reply::Simple(b"PONG".to_vec()));
/// # Ok::<(), Box<dyn std::error::Error>>(())
/// ```
pub