Skip to content

Commit d5f4da2

Browse files
authored
Merge pull request #3 from zed-industries/cleaner-trait-interfaces
Support RPC methods with no parameters or response
2 parents c44bd2f + 488a5f0 commit d5f4da2

File tree

8 files changed

+298
-134
lines changed

8 files changed

+298
-134
lines changed

Cargo.lock

Lines changed: 0 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ path = "rust/generate.rs"
1414

1515
[dependencies]
1616
anyhow = "1.0"
17-
async-trait = "0.1"
1817
schemars = { version = "1.0", features = ["chrono04"] }
1918
serde = { version = "1.0", features = ["derive"] }
2019
serde_json = { version = "1.0", features = ["raw_value"] }

rust/acp_tests.rs

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,37 @@
11
use super::*;
22
use anyhow::Result;
3-
use async_trait::async_trait;
43
use tokio::task::LocalSet;
54
use tokio::time::{Duration, timeout};
65

76
pub struct TestClient;
87
pub struct TestAgent;
98

10-
#[async_trait(?Send)]
119
impl Agent for TestAgent {
12-
async fn initialize(&self, _request: InitializeParams) -> Result<InitializeResponse> {
10+
async fn initialize(&self) -> Result<InitializeResponse> {
1311
Ok(InitializeResponse {
1412
is_authenticated: true,
1513
})
1614
}
1715

18-
async fn authenticate(&self, _request: AuthenticateParams) -> Result<AuthenticateResponse> {
19-
Ok(AuthenticateResponse)
16+
async fn authenticate(&self) -> Result<()> {
17+
Ok(())
2018
}
2119

22-
async fn send_user_message(
23-
&self,
24-
_request: SendUserMessageParams,
25-
) -> Result<SendUserMessageResponse> {
26-
Ok(SendUserMessageResponse)
20+
async fn send_user_message(&self, _request: SendUserMessageParams) -> Result<()> {
21+
Ok(())
2722
}
2823

29-
async fn cancel_send_message(
30-
&self,
31-
_request: CancelSendMessageParams,
32-
) -> Result<CancelSendMessageResponse> {
33-
Ok(CancelSendMessageResponse)
24+
async fn cancel_send_message(&self) -> Result<()> {
25+
Ok(())
3426
}
3527
}
3628

37-
#[async_trait(?Send)]
3829
impl Client for TestClient {
3930
async fn stream_assistant_message_chunk(
4031
&self,
4132
_request: StreamAssistantMessageChunkParams,
42-
) -> Result<StreamAssistantMessageChunkResponse> {
43-
Ok(StreamAssistantMessageChunkResponse {})
33+
) -> Result<()> {
34+
Ok(())
4435
}
4536

4637
async fn request_tool_call_confirmation(
@@ -57,11 +48,8 @@ impl Client for TestClient {
5748
Ok(PushToolCallResponse { id: ToolCallId(0) })
5849
}
5950

60-
async fn update_tool_call(
61-
&self,
62-
_request: UpdateToolCallParams,
63-
) -> Result<UpdateToolCallResponse> {
64-
Ok(UpdateToolCallResponse)
51+
async fn update_tool_call(&self, _request: UpdateToolCallParams) -> Result<()> {
52+
Ok(())
6553
}
6654
}
6755

0 commit comments

Comments
 (0)