Skip to content

Commit da6b58e

Browse files
authored
Merge pull request #3 from n0-computer/even-more-macros
feat: Extend derive macro
2 parents 67ee467 + a3f1c95 commit da6b58e

File tree

8 files changed

+280
-127
lines changed

8 files changed

+280
-127
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ rust-version = "1.76"
1414

1515
[dependencies]
1616
# we require serde even in non-rpc mode
17-
serde = { version = "1", default-features = false }
17+
serde = { workspace = true }
1818
# just for the oneshot and mpsc queues
19-
tokio = { version = "1.44", features = ["sync"], default-features = false }
19+
tokio = { workspace = true, features = ["sync"] }
2020
# for PollSender (which for some reason is not available in the main tokio api)
2121
tokio-util = { version = "0.7.14", default-features = false }
2222
# errors
2323
thiserror = "2.0.12"
2424

2525
# used in the endpoint handler code when using rpc
26-
tracing = { version = "0.1.41", optional = true }
26+
tracing = { workspace = true, optional = true }
2727
# used to ser/de messages when using rpc
28-
postcard = { version = "1.1.1", features = ["alloc", "use-std"], optional = true }
28+
postcard = { workspace = true, features = ["alloc", "use-std"], optional = true }
2929
# currently only transport when using rpc
3030
quinn = { version = "0.13.0", package = "iroh-quinn", optional = true }
3131
# used as a buffer for serialization when using rpc
@@ -35,22 +35,23 @@ rustls = { version = "0.23.5", default-features = false, features = ["std"], opt
3535
# used in the test utils to generate quinn endpoints
3636
rcgen = { version = "0.13.2", optional = true }
3737
# used in the test utils to generate quinn endpoints
38-
anyhow = { version = "1.0.66", optional = true }
38+
anyhow = { workspace = true, optional = true }
3939
# used in the benches
4040
futures-buffered ={ version = "0.2.9", optional = true }
4141

4242
[dev-dependencies]
43-
tracing-subscriber = { version = "0.3.19", features = ["fmt"] }
43+
tracing-subscriber = { workspace = true, features = ["fmt"] }
4444
# used in the derive example. This must not be a main crate dep or else it will be circular!
4545
irpc-derive = { version = "0.1.0", path = "./irpc-derive" }
46-
# just convenient for the enum definitions
46+
# just convenient for the enum definitions, in the manual example
4747
derive_more = { version = "2", features = ["from"] }
4848
# we need full for example main etc.
49-
tokio = { version = "1", features = ["full"] }
49+
tokio = { workspace = true, features = ["full"] }
5050
# formatting
5151
thousands = "0.2.0"
5252
# for AbortOnDropHandle
53-
n0-future = { version = "0.1.2" }
53+
n0-future = { workspace = true }
54+
# macro tests
5455
trybuild = "1.0.104"
5556

5657
[features]
@@ -71,3 +72,13 @@ rustdoc-args = ["--cfg", "quicrpc_docsrs"]
7172

7273
[lints.rust]
7374
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(quicrpc_docsrs)"] }
75+
76+
[workspace.dependencies]
77+
anyhow = { version = "1.0.66" }
78+
tokio = { version = "1.44", default-features = false }
79+
postcard = { version = "1.1.1", default-features = false }
80+
serde = { version = "1", default-features = false }
81+
tracing = { version = "0.1.41", default-features = false }
82+
n0-future = { version = "0.1.2", default-features = false }
83+
tracing-subscriber = { version = "0.3.19", default-features = false }
84+
iroh = { version = "0.34" }

examples/compute.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ enum ComputeRequest {
5656
}
5757

5858
// Define the protocol and message enums using the macro
59-
#[rpc_requests(ComputeService, ComputeMessage)]
59+
#[rpc_requests(ComputeService, message = ComputeMessage)]
6060
#[derive(Serialize, Deserialize)]
6161
enum ComputeProtocol {
6262
#[rpc(tx=oneshot::Sender<u128>)]

examples/derive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct Set {
3939

4040
// Use the macro to generate both the StorageProtocol and StorageMessage enums
4141
// plus implement Channels for each type
42-
#[rpc_requests(StorageService, StorageMessage)]
42+
#[rpc_requests(StorageService, message = StorageMessage)]
4343
#[derive(Serialize, Deserialize)]
4444
enum StorageProtocol {
4545
#[rpc(tx=oneshot::Sender<Option<String>>)]

0 commit comments

Comments
 (0)