improvement: update macros to not require manual imports#1071
improvement: update macros to not require manual imports#1071timokoesters wants to merge 3 commits intorhaiscript:mainfrom
Conversation
|
It could be made even more robust by adding the absolute path for Vec and Ok, but I think that's too messy to read and has little benefit |
|
My question is: what if the user pulls in Rhai under a different name? |
|
There are some CI tests not passing. Can you also take care of those? Thanks. |
|
Can you put in an attribute (e.g. The test output failure I can fix. |
timokoesters
left a comment
There was a problem hiding this comment.
I've implemented the root argument and added a test for it called one_arg_fn_with_context_custom_root
|
|
||
| output.extend(function_def.generate()); | ||
| // This function is deprecated and does not have custom root support | ||
| let root: Path = syn::parse_quote!(::rhai); |
There was a problem hiding this comment.
::rhai is hard coded for this and a few more deprecated function.
| || p.path == context_type_path2 | ||
| || p.path == context_type_path2x => | ||
| if p.path.segments.last().map(|s| s.ident.to_string()) | ||
| == Some("NativeCallContext".to_owned()) => |
There was a problem hiding this comment.
This function is an implementation of Parser and I could not pass the custom root here. For checking NativeCallContext I instead only compare the last segment of the path.
This should make it easier for users of the library, because they don't have to add random
usestatements for all the things the macros need.