uazu / stakker

A lightweight low-level single-threaded actor runtime
https://uazu.github.io/stakker/
Apache License 2.0
167 stars 9 forks source link

Pass long path name to macro #30

Closed veniamin-ilmer closed 2 years ago

veniamin-ilmer commented 2 years ago

Working off the tutorial:

actor!(stakker, Light::init(), ret_nop!());

This works because Light is defined locally.

If I have Light defined in a separate module, I get an error with this code:

actor!(stakker, submodule::Light::init(), ret_nop!());

The current workaround:

use submodule::Light;
actor!(stakker, Light::init(), ret_nop!());
uazu commented 2 years ago

It's a limitation of macro_rules macros. I couldn't see any way to parse all of the :: sections except the last. So the workaround I adopted is to put the type-path in <...>, like this: actor!(stakker, <submodule::Light>::init(), ret_nop!());

veniamin-ilmer commented 2 years ago

OK, I will take this into account, thank you