@@ -255,7 +255,6 @@ use std::{any::Any, error::Error, io, sync::Arc, time::Instant};
255
255
/// A message from a client to a server.
256
256
#[ derive( Debug ) ]
257
257
#[ cfg_attr( feature = "serde1" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
258
- #[ non_exhaustive]
259
258
pub enum ClientMessage < T > {
260
259
/// A request initiated by a user. The server responds to a request by invoking a
261
260
/// service-provided request handler. The handler completes with a [`response`](Response), which
@@ -280,7 +279,6 @@ pub enum ClientMessage<T> {
280
279
281
280
/// A request from a client to a server.
282
281
#[ derive( Clone , Copy , Debug ) ]
283
- #[ non_exhaustive]
284
282
#[ cfg_attr( feature = "serde1" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
285
283
pub struct Request < T > {
286
284
/// Trace context, deadline, and other cross-cutting concerns.
@@ -294,14 +292,14 @@ pub struct Request<T> {
294
292
/// Implemented by the request types generated by tarpc::service.
295
293
pub trait RequestName {
296
294
/// The name of a request.
297
- fn name ( & self ) -> & ' static str ;
295
+ fn name ( & self ) -> & str ;
298
296
}
299
297
300
298
impl < Req > RequestName for Arc < Req >
301
299
where
302
300
Req : RequestName ,
303
301
{
304
- fn name ( & self ) -> & ' static str {
302
+ fn name ( & self ) -> & str {
305
303
self . as_ref ( ) . name ( )
306
304
}
307
305
}
@@ -310,57 +308,56 @@ impl<Req> RequestName for Box<Req>
310
308
where
311
309
Req : RequestName ,
312
310
{
313
- fn name ( & self ) -> & ' static str {
311
+ fn name ( & self ) -> & str {
314
312
self . as_ref ( ) . name ( )
315
313
}
316
314
}
317
315
318
316
/// Impls for common std types for testing.
319
317
impl RequestName for String {
320
- fn name ( & self ) -> & ' static str {
318
+ fn name ( & self ) -> & str {
321
319
"string"
322
320
}
323
321
}
324
322
325
323
impl RequestName for char {
326
- fn name ( & self ) -> & ' static str {
324
+ fn name ( & self ) -> & str {
327
325
"char"
328
326
}
329
327
}
330
328
331
329
impl RequestName for ( ) {
332
- fn name ( & self ) -> & ' static str {
330
+ fn name ( & self ) -> & str {
333
331
"unit"
334
332
}
335
333
}
336
334
337
335
impl RequestName for i32 {
338
- fn name ( & self ) -> & ' static str {
336
+ fn name ( & self ) -> & str {
339
337
"i32"
340
338
}
341
339
}
342
340
343
341
impl RequestName for u32 {
344
- fn name ( & self ) -> & ' static str {
342
+ fn name ( & self ) -> & str {
345
343
"u32"
346
344
}
347
345
}
348
346
349
347
impl RequestName for i64 {
350
- fn name ( & self ) -> & ' static str {
348
+ fn name ( & self ) -> & str {
351
349
"i64"
352
350
}
353
351
}
354
352
355
353
impl RequestName for u64 {
356
- fn name ( & self ) -> & ' static str {
354
+ fn name ( & self ) -> & str {
357
355
"u64"
358
356
}
359
357
}
360
358
361
359
/// A response from a server to a client.
362
360
#[ derive( Clone , Debug , PartialEq , Eq , Hash ) ]
363
- #[ non_exhaustive]
364
361
#[ cfg_attr( feature = "serde1" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
365
362
pub struct Response < T > {
366
363
/// The ID of the request being responded to.
0 commit comments