Skip to content

Commit 2a083a7

Browse files
committed
add capnp::generated_code macro
1 parent 42a460e commit 2a083a7

File tree

20 files changed

+50
-106
lines changed

20 files changed

+50
-106
lines changed

benchmark/benchmark.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,15 @@ use capnp::{message, serialize, serialize_packed};
2626

2727
pub mod common;
2828

29-
pub mod carsales_capnp {
30-
include!(concat!(env!("OUT_DIR"), "/carsales_capnp.rs"));
31-
}
29+
capnp::generated_code!(pub mod carsales_capnp, "carsales_capnp.rs");
30+
3231
pub mod carsales;
3332

34-
pub mod catrank_capnp {
35-
include!(concat!(env!("OUT_DIR"), "/catrank_capnp.rs"));
36-
}
33+
capnp::generated_code!(pub mod catrank_capnp, "catrank_capnp.rs");
34+
3735
pub mod catrank;
3836

39-
pub mod eval_capnp {
40-
include!(concat!(env!("OUT_DIR"), "/eval_capnp.rs"));
41-
}
37+
capnp::generated_code!(pub mod eval_capnp, "eval_capnp.rs");
4238

4339
pub mod eval;
4440

capnp-futures/test/test.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2020
// THE SOFTWARE.
2121

22-
pub mod addressbook_capnp {
23-
include!(concat!(env!("OUT_DIR"), "/addressbook_capnp.rs"));
24-
}
22+
capnp::generated_code!(pub mod addressbook_capnp, "addressbook_capnp.rs");
2523

2624
#[cfg(test)]
2725
mod tests {

capnp-rpc/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ fn main() {
4242
and you can include the generated code in your project like this:
4343

4444
```rust
45-
pub mod foo_capnp {
46-
include!(concat!(env!("OUT_DIR"), "/foo_capnp.rs"));
47-
}
45+
capnp::generated_code!(pub mod foo_capnp, "foo_capnp.rs");
4846
```
4947

5048
## Calling methods on an RPC object

capnp-rpc/examples/calculator/main.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2020
// THE SOFTWARE.
2121

22-
pub mod calculator_capnp {
23-
include!(concat!(env!("OUT_DIR"), "/calculator_capnp.rs"));
24-
}
22+
capnp::generated_code!(pub mod calculator_capnp, "calculator_capnp.rs");
2523

2624
pub mod client;
2725
pub mod server;

capnp-rpc/examples/hello-world/main.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2020
// THE SOFTWARE.
2121

22-
pub mod hello_world_capnp {
23-
include!(concat!(env!("OUT_DIR"), "/hello_world_capnp.rs"));
24-
}
22+
capnp::generated_code!(pub mod hello_world_capnp, "hello_world_capnp.rs");
2523

2624
pub mod client;
2725
pub mod server;

capnp-rpc/examples/pubsub/main.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2020
// THE SOFTWARE.
2121

22-
pub mod pubsub_capnp {
23-
include!(concat!(env!("OUT_DIR"), "/pubsub_capnp.rs"));
24-
}
22+
capnp::generated_code!(pub mod pubsub_capnp, "pubsub_capnp.rs");
2523

2624
pub mod client;
2725
pub mod server;

capnp-rpc/examples/reconnect/main.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2020
// THE SOFTWARE.
2121

22-
pub mod foo_capnp {
23-
include!(concat!(env!("OUT_DIR"), "/foo_capnp.rs"));
24-
}
22+
capnp::generated_code!(pub mod foo_capnp, "foo_capnp.rs");
2523

2624
pub mod client;
2725
pub mod server;

capnp-rpc/examples/streaming/main.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
pub mod streaming_capnp {
2-
include!(concat!(env!("OUT_DIR"), "/streaming_capnp.rs"));
3-
}
1+
capnp::generated_code!(pub mod streaming_capnp, "streaming_capnp.rs");
42

53
pub mod client;
64
pub mod server;

capnp-rpc/test/test.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ use capnp_rpc::{rpc_twoparty_capnp, twoparty, RpcSystem};
2929
use futures::channel::oneshot;
3030
use futures::{Future, FutureExt, TryFutureExt};
3131

32-
pub mod test_capnp {
33-
include!(concat!(env!("OUT_DIR"), "/test_capnp.rs"));
34-
}
32+
capnp::generated_code!(pub mod test_capnp, "test_capnp.rs");
3533

3634
pub mod impls;
3735
pub mod reconnect_test;

capnp/fuzz/fuzzers/test_all_types.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#![no_main]
22

3-
pub mod test_capnp {
4-
include!(concat!(env!("OUT_DIR"), "/test_capnp.rs"));
5-
}
3+
capnp::generated_code!(pub mod test_capnp, "test_capnp.rs");
64

75
use capnp::{message, serialize};
86
use libfuzzer_sys::fuzz_target;

0 commit comments

Comments
 (0)