ed-acp: say that serve handles one connection per call
serve consumes its transport and resolves when that client hangs up, so serving a second client means calling it again with a new transport. The doc comment implied this; now it says so. Also make the embedding example in the crate docs parse, so rustdoc stops warning about it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: siGit Code v1.6.3 <noreply@sigit.si>
Seto Elkahfi committed
Oct 9, 2026 at 15:26 UTC
83feb55fd46a93a6dba97d6d5d17538d69b20221
2 files changed
+10
-1
crates/ed-acp/src/lib.rs
+7
-1
@@ -23,7 +23,13 @@
23
//! ```ignore
24
//! let (agent_end, client_end) = agent_client_protocol::Channel::duplex();
25
//! tokio::spawn(ed_acp::serve(profile, opts, agent_end));
26
-//! agent_client_protocol::Client.builder().connect_with(client_end, |conn| async move { … });
26
+//! agent_client_protocol::Client
27
+//! .builder()
28
+//! .connect_with(client_end, |conn| async move {
29
+//! conn.send_request(InitializeRequest::new(ProtocolVersion::V1)).block_task().await?;
30
+//! Ok(())
31
+//! })
32
+//! .await?;
33
//! ```
34
35
mod agent;
crates/ed-acp/src/server.rs
+3
@@ -51,6 +51,9 @@ pub async fn serve_stdio(
51
/// subprocess, for example an app in the macOS App Store sandbox: connect it to
52
/// [`Channel::duplex`](agent_client_protocol::Channel::duplex) and run an ACP client on the
53
/// other end.
54
+///
55
+/// One call serves one connection: the transport is consumed, and the future resolves when
56
+/// that client hangs up. To serve another client, call `serve` again with a new transport.
57
pub async fn serve(
58
profile: Arc<dyn Profile>,
59
opts: ServeOptions,