Skip to content

Commit a8a2a18

Browse files
committed
PR review:
- make test more realistic - add comment
1 parent f5aa36a commit a8a2a18

File tree

2 files changed

+29
-9
lines changed

2 files changed

+29
-9
lines changed

quic-rpc-derive/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ pub fn rpc_requests(attr: TokenStream, item: TokenStream) -> TokenStream {
134134
.into();
135135
}
136136

137-
//
137+
// Extract and remove RPC attributes
138138
let mut rpc_attr = Vec::new();
139139
variant.attrs.retain(|attr| {
140140
for ident in IDENTS {

quic-rpc-derive/tests/smoke.rs

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,45 @@ fn simple() {
1515
#[derive(Debug, Serialize, Deserialize)]
1616
struct BidiStreamingRequest;
1717

18+
#[derive(Debug, Serialize, Deserialize)]
19+
struct Update1;
20+
21+
#[derive(Debug, Serialize, Deserialize)]
22+
struct Update2;
23+
24+
#[derive(Debug, Serialize, Deserialize)]
25+
struct Response1;
26+
27+
#[derive(Debug, Serialize, Deserialize)]
28+
struct Response2;
29+
30+
#[derive(Debug, Serialize, Deserialize)]
31+
struct Response3;
32+
33+
#[derive(Debug, Serialize, Deserialize)]
34+
struct Response4;
35+
1836
#[rpc_requests(Service)]
1937
#[derive(Debug, Serialize, Deserialize, derive_more::From, derive_more::TryInto)]
2038
enum Request {
21-
#[rpc(response=u32)]
39+
#[rpc(response=Response1)]
2240
Rpc(RpcRequest),
23-
#[server_streaming(response=())]
41+
#[server_streaming(response=Response2)]
2442
ServerStreaming(ServerStreamingRequest),
25-
#[bidi_streaming(update=(), response = ())]
43+
#[bidi_streaming(update= Update1, response = Response3)]
2644
BidiStreaming(BidiStreamingRequest),
27-
#[client_streaming(update = (), response = ())]
45+
#[client_streaming(update = Update2, response = Response4)]
2846
ClientStreaming(ClientStreamingRequest),
29-
// an update, you will never get this as the first message
30-
GenericUpdate(()),
47+
Update1(Update1),
48+
Update2(Update2),
3149
}
3250

3351
#[derive(Debug, Serialize, Deserialize, derive_more::From, derive_more::TryInto)]
3452
enum Response {
35-
Void(()),
36-
Rpc(u32),
53+
Response1(Response1),
54+
Response2(Response2),
55+
Response3(Response3),
56+
Response4(Response4),
3757
}
3858

3959
#[derive(Debug, Clone)]

0 commit comments

Comments
 (0)