Skip to content

Commit 6881a3c

Browse files
committed
[tech] Add procmacro as a feature of relations
1 parent bf681f8 commit 6881a3c

File tree

8 files changed

+13
-10
lines changed

8 files changed

+13
-10
lines changed

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ members = [
1919

2020
[dependencies]
2121
derivative = "1"
22+
relations_procmacro = { version = "1", path = "./relations_procmacro/", optional = true }
2223
thiserror = "1"
2324
typed_index_collection = "1"
2425

25-
[dev-dependencies]
26-
relations_procmacro = { version = "1", path = "./relations_procmacro/" }
26+
[features]
27+
default = ["relations_procmacro"]

relations_procmacro/tests/01-get-corresponding.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
mod test_utils;
22

33
use relations::*;
4-
use relations_procmacro::*;
54
use test_utils::*;
65
use typed_index_collection::*;
76

relations_procmacro/tests/02-invalid-weight.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
mod test_utils;
22

33
use relations::*;
4-
use relations_procmacro::*;
54
use test_utils::*;
65
use typed_index_collection::*;
76

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error: proc-macro derive panicked
2-
--> $DIR/02-invalid-weight.rs:8:10
2+
--> $DIR/02-invalid-weight.rs:7:10
33
|
4-
8 | #[derive(GetCorresponding)]
4+
7 | #[derive(GetCorresponding)]
55
| ^^^^^^^^^^^^^^^^
66
|
77
= help: message: `weight` attribute must be convertible to f64: ParseFloatError { kind: Invalid }

relations_procmacro/tests/03-non-supported-argument.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
mod test_utils;
22

33
use relations::*;
4-
use relations_procmacro::*;
54
use test_utils::*;
65
use typed_index_collection::*;
76

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error: proc-macro derive panicked
2-
--> $DIR/03-non-supported-argument.rs:8:10
2+
--> $DIR/03-non-supported-argument.rs:7:10
33
|
4-
8 | #[derive(GetCorresponding)]
4+
7 | #[derive(GetCorresponding)]
55
| ^^^^^^^^^^^^^^^^
66
|
77
= help: message: Only `key = "value"` attributes supported.

relations_procmacro/tests/04-get-corresponding-without-data.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
mod test_utils;
22

33
use relations::*;
4-
use relations_procmacro::*;
54
use test_utils::*;
65
use typed_index_collection::*;
76

src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
//! Modeling the relations between objects.
2+
//!
3+
//! By default, feature `relations_procmacro` is enabled, exposing macros to
4+
//! help build relations. See documentation of the crate `relations_procmacro`
5+
//! for more information.
26
37
mod error;
48
mod relations;
59

610
pub use crate::error::*;
711
pub use crate::relations::*;
12+
#[cfg(feature = "relations_procmacro")]
13+
pub use relations_procmacro::*;

0 commit comments

Comments
 (0)