Skip to content

Commit 43a0c97

Browse files
committed
Update the example for Rust
1 parent 1fcf031 commit 43a0c97

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

examples/rust/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ version = "0.0.0"
77
edition = "2018"
88
publish = false
99

10+
[lib]
11+
name = "crate" # This crate itself is not intended to be used directly.
12+
1013
[dependencies]
1114
verification-helper-rust-example-hello = { path = "crates/helloworld/hello" }
1215
verification-helper-rust-example-input = { path = "crates/io/input" }

examples/rust/src/lib.rs

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
//! Re-exports the crates for rustdoc.
2+
//!
3+
//! This crate itself is not intended to be used directly.
4+
5+
// With `custom-build` and `syn` crate, we can expand crate-level rustdocs.
6+
7+
macro_rules! re_export(($($name:ident),* $(,)?) => ($(pub mod $name { pub use ::$name::*; })*));
8+
29
pub mod helloworld {
310
//! Crates of "hello" and "world".
4-
pub mod hello {
5-
//! A re-export of `verification-helper-rust-example-hello`.
6-
pub use hello::*;
7-
}
8-
pub mod world {
9-
//! A re-export of `verification-helper-rust-example-world`.
10-
pub use world::*;
11-
}
11+
12+
re_export!(hello, world);
1213
}
14+
1315
pub mod io {
1416
//! Crates about IO.
15-
pub mod input {
16-
//! A re-export of `verification-helper-rust-example-input`.
17-
pub use input::*;
18-
}
19-
pub mod scanner {
20-
//! A re-export of `verification-helper-rust-example-scanner`.
21-
pub use scanner::*;
22-
}
17+
18+
re_export!(input, scanner);
2319
}

0 commit comments

Comments
 (0)