summaryrefslogtreecommitdiff
path: root/engine-macros/src/util.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2026-06-12 22:13:14 +0200
committerHampusM <hampus@hampusmat.com>2026-06-12 22:13:14 +0200
commitcd4219fae7f29b9c3d96aee640cefb6b2639e1a8 (patch)
tree0ec6967f9d077458f3c05985371f358ee13eaaa9 /engine-macros/src/util.rs
parent52e42bfdb3d56644da03e60969b1a2bedac8efc2 (diff)
fix(engine): make Reflection derive macro add Reflection type param boundsHEADmaster
Diffstat (limited to 'engine-macros/src/util.rs')
-rw-r--r--engine-macros/src/util.rs24
1 files changed, 22 insertions, 2 deletions
diff --git a/engine-macros/src/util.rs b/engine-macros/src/util.rs
index 515b066..327c517 100644
--- a/engine-macros/src/util.rs
+++ b/engine-macros/src/util.rs
@@ -7,8 +7,8 @@ macro_rules! syn_path {
::syn::Path {
leading_colon: None,
segments: ::syn::punctuated::Punctuated::from_iter([
- syn_path_segment!($first_segment),
- $(syn_path_segment!($segment),)*
+ $crate::util::syn_path_segment!($first_segment),
+ $($crate::util::syn_path_segment!($segment),)*
])
}
};
@@ -26,6 +26,9 @@ macro_rules! syn_path_segment {
};
}
+pub(crate) use syn_path;
+pub(crate) use syn_path_segment;
+
pub fn find_engine_crate_path() -> Option<syn::Path>
{
let cargo_crate_name = std::env::var("CARGO_CRATE_NAME").ok()?;
@@ -63,3 +66,20 @@ pub fn syn_path_to_string(path: &syn::Path) -> String
output
}
+
+pub trait SynPathExt
+{
+ fn join(&self, tail: Self) -> Self;
+}
+
+impl SynPathExt for syn::Path
+{
+ fn join(&self, tail: Self) -> Self
+ {
+ let mut new = self.clone();
+
+ new.segments.extend(tail.segments);
+
+ new
+ }
+}