Skip to content

Commit e6b4e30

Browse files
authored
Fix missing as_ref calls for trait impls (#111)
1 parent 0f65a51 commit e6b4e30

2 files changed

Lines changed: 42 additions & 42 deletions

File tree

rust/agent.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -147,82 +147,82 @@ pub trait Agent {
147147
#[async_trait::async_trait(?Send)]
148148
impl<T: Agent> Agent for Rc<T> {
149149
async fn initialize(&self, args: InitializeRequest) -> Result<InitializeResponse, Error> {
150-
self.initialize(args).await
150+
self.as_ref().initialize(args).await
151151
}
152152
async fn authenticate(&self, args: AuthenticateRequest) -> Result<AuthenticateResponse, Error> {
153-
self.authenticate(args).await
153+
self.as_ref().authenticate(args).await
154154
}
155155
async fn new_session(&self, args: NewSessionRequest) -> Result<NewSessionResponse, Error> {
156-
self.new_session(args).await
156+
self.as_ref().new_session(args).await
157157
}
158158
async fn load_session(&self, args: LoadSessionRequest) -> Result<LoadSessionResponse, Error> {
159-
self.load_session(args).await
159+
self.as_ref().load_session(args).await
160160
}
161161
async fn set_session_mode(
162162
&self,
163163
args: SetSessionModeRequest,
164164
) -> Result<SetSessionModeResponse, Error> {
165-
self.set_session_mode(args).await
165+
self.as_ref().set_session_mode(args).await
166166
}
167167
async fn prompt(&self, args: PromptRequest) -> Result<PromptResponse, Error> {
168-
self.prompt(args).await
168+
self.as_ref().prompt(args).await
169169
}
170170
async fn cancel(&self, args: CancelNotification) -> Result<(), Error> {
171-
self.cancel(args).await
171+
self.as_ref().cancel(args).await
172172
}
173173
#[cfg(feature = "unstable")]
174174
async fn set_session_model(
175175
&self,
176176
args: SetSessionModelRequest,
177177
) -> Result<SetSessionModelResponse, Error> {
178-
self.set_session_model(args).await
178+
self.as_ref().set_session_model(args).await
179179
}
180180
async fn ext_method(&self, args: ExtRequest) -> Result<ExtResponse, Error> {
181-
self.ext_method(args).await
181+
self.as_ref().ext_method(args).await
182182
}
183183
async fn ext_notification(&self, args: ExtNotification) -> Result<(), Error> {
184-
self.ext_notification(args).await
184+
self.as_ref().ext_notification(args).await
185185
}
186186
}
187187

188188
#[async_trait::async_trait(?Send)]
189189
impl<T: Agent> Agent for Arc<T> {
190190
async fn initialize(&self, args: InitializeRequest) -> Result<InitializeResponse, Error> {
191-
self.initialize(args).await
191+
self.as_ref().initialize(args).await
192192
}
193193
async fn authenticate(&self, args: AuthenticateRequest) -> Result<AuthenticateResponse, Error> {
194-
self.authenticate(args).await
194+
self.as_ref().authenticate(args).await
195195
}
196196
async fn new_session(&self, args: NewSessionRequest) -> Result<NewSessionResponse, Error> {
197-
self.new_session(args).await
197+
self.as_ref().new_session(args).await
198198
}
199199
async fn load_session(&self, args: LoadSessionRequest) -> Result<LoadSessionResponse, Error> {
200-
self.load_session(args).await
200+
self.as_ref().load_session(args).await
201201
}
202202
async fn set_session_mode(
203203
&self,
204204
args: SetSessionModeRequest,
205205
) -> Result<SetSessionModeResponse, Error> {
206-
self.set_session_mode(args).await
206+
self.as_ref().set_session_mode(args).await
207207
}
208208
async fn prompt(&self, args: PromptRequest) -> Result<PromptResponse, Error> {
209-
self.prompt(args).await
209+
self.as_ref().prompt(args).await
210210
}
211211
async fn cancel(&self, args: CancelNotification) -> Result<(), Error> {
212-
self.cancel(args).await
212+
self.as_ref().cancel(args).await
213213
}
214214
#[cfg(feature = "unstable")]
215215
async fn set_session_model(
216216
&self,
217217
args: SetSessionModelRequest,
218218
) -> Result<SetSessionModelResponse, Error> {
219-
self.set_session_model(args).await
219+
self.as_ref().set_session_model(args).await
220220
}
221221
async fn ext_method(&self, args: ExtRequest) -> Result<ExtResponse, Error> {
222-
self.ext_method(args).await
222+
self.as_ref().ext_method(args).await
223223
}
224224
async fn ext_notification(&self, args: ExtNotification) -> Result<(), Error> {
225-
self.ext_notification(args).await
225+
self.as_ref().ext_notification(args).await
226226
}
227227
}
228228

rust/client.rs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -169,58 +169,58 @@ impl<T: Client> Client for Rc<T> {
169169
&self,
170170
args: RequestPermissionRequest,
171171
) -> Result<RequestPermissionResponse, Error> {
172-
self.request_permission(args).await
172+
self.as_ref().request_permission(args).await
173173
}
174174
async fn write_text_file(
175175
&self,
176176
args: WriteTextFileRequest,
177177
) -> Result<WriteTextFileResponse, Error> {
178-
self.write_text_file(args).await
178+
self.as_ref().write_text_file(args).await
179179
}
180180
async fn read_text_file(
181181
&self,
182182
args: ReadTextFileRequest,
183183
) -> Result<ReadTextFileResponse, Error> {
184-
self.read_text_file(args).await
184+
self.as_ref().read_text_file(args).await
185185
}
186186
async fn session_notification(&self, args: SessionNotification) -> Result<(), Error> {
187-
self.session_notification(args).await
187+
self.as_ref().session_notification(args).await
188188
}
189189
async fn create_terminal(
190190
&self,
191191
args: CreateTerminalRequest,
192192
) -> Result<CreateTerminalResponse, Error> {
193-
self.create_terminal(args).await
193+
self.as_ref().create_terminal(args).await
194194
}
195195
async fn terminal_output(
196196
&self,
197197
args: TerminalOutputRequest,
198198
) -> Result<TerminalOutputResponse, Error> {
199-
self.terminal_output(args).await
199+
self.as_ref().terminal_output(args).await
200200
}
201201
async fn release_terminal(
202202
&self,
203203
args: ReleaseTerminalRequest,
204204
) -> Result<ReleaseTerminalResponse, Error> {
205-
self.release_terminal(args).await
205+
self.as_ref().release_terminal(args).await
206206
}
207207
async fn wait_for_terminal_exit(
208208
&self,
209209
args: WaitForTerminalExitRequest,
210210
) -> Result<WaitForTerminalExitResponse, Error> {
211-
self.wait_for_terminal_exit(args).await
211+
self.as_ref().wait_for_terminal_exit(args).await
212212
}
213213
async fn kill_terminal_command(
214214
&self,
215215
args: KillTerminalCommandRequest,
216216
) -> Result<KillTerminalCommandResponse, Error> {
217-
self.kill_terminal_command(args).await
217+
self.as_ref().kill_terminal_command(args).await
218218
}
219219
async fn ext_method(&self, args: ExtRequest) -> Result<ExtResponse, Error> {
220-
self.ext_method(args).await
220+
self.as_ref().ext_method(args).await
221221
}
222222
async fn ext_notification(&self, args: ExtNotification) -> Result<(), Error> {
223-
self.ext_notification(args).await
223+
self.as_ref().ext_notification(args).await
224224
}
225225
}
226226

@@ -230,58 +230,58 @@ impl<T: Client> Client for Arc<T> {
230230
&self,
231231
args: RequestPermissionRequest,
232232
) -> Result<RequestPermissionResponse, Error> {
233-
self.request_permission(args).await
233+
self.as_ref().request_permission(args).await
234234
}
235235
async fn write_text_file(
236236
&self,
237237
args: WriteTextFileRequest,
238238
) -> Result<WriteTextFileResponse, Error> {
239-
self.write_text_file(args).await
239+
self.as_ref().write_text_file(args).await
240240
}
241241
async fn read_text_file(
242242
&self,
243243
args: ReadTextFileRequest,
244244
) -> Result<ReadTextFileResponse, Error> {
245-
self.read_text_file(args).await
245+
self.as_ref().read_text_file(args).await
246246
}
247247
async fn session_notification(&self, args: SessionNotification) -> Result<(), Error> {
248-
self.session_notification(args).await
248+
self.as_ref().session_notification(args).await
249249
}
250250
async fn create_terminal(
251251
&self,
252252
args: CreateTerminalRequest,
253253
) -> Result<CreateTerminalResponse, Error> {
254-
self.create_terminal(args).await
254+
self.as_ref().create_terminal(args).await
255255
}
256256
async fn terminal_output(
257257
&self,
258258
args: TerminalOutputRequest,
259259
) -> Result<TerminalOutputResponse, Error> {
260-
self.terminal_output(args).await
260+
self.as_ref().terminal_output(args).await
261261
}
262262
async fn release_terminal(
263263
&self,
264264
args: ReleaseTerminalRequest,
265265
) -> Result<ReleaseTerminalResponse, Error> {
266-
self.release_terminal(args).await
266+
self.as_ref().release_terminal(args).await
267267
}
268268
async fn wait_for_terminal_exit(
269269
&self,
270270
args: WaitForTerminalExitRequest,
271271
) -> Result<WaitForTerminalExitResponse, Error> {
272-
self.wait_for_terminal_exit(args).await
272+
self.as_ref().wait_for_terminal_exit(args).await
273273
}
274274
async fn kill_terminal_command(
275275
&self,
276276
args: KillTerminalCommandRequest,
277277
) -> Result<KillTerminalCommandResponse, Error> {
278-
self.kill_terminal_command(args).await
278+
self.as_ref().kill_terminal_command(args).await
279279
}
280280
async fn ext_method(&self, args: ExtRequest) -> Result<ExtResponse, Error> {
281-
self.ext_method(args).await
281+
self.as_ref().ext_method(args).await
282282
}
283283
async fn ext_notification(&self, args: ExtNotification) -> Result<(), Error> {
284-
self.ext_notification(args).await
284+
self.as_ref().ext_notification(args).await
285285
}
286286
}
287287

0 commit comments

Comments
 (0)