ozgunozerk/state-shift

๐Ÿž [Bug]: Multiple invocations fail

Closed this issue ยท 4 comments

What happened?

Trying to setup multiple typestate patterns fails because some defintions are repeated, i.e.:

'the name `sealed` is defined multiple times
`sealed` must be defined only once in the type namespace of this module

Expected behavior

No response

As a workaraound in some cases you could move the different typestate patterns into separate modules. But in this specific case I have a larger object implementation that has a type state and additionally a method with a builder pattern.

I see. I probably messed up the macro hygiene.
Again, a minimal reproducible example would help a lot if you have the time ๐Ÿ‘

Just pasting two of the examples into one file should be sufficient to reproduce. Sorry won't have much time the next 9 days.

cat tests/lifetime_example.rs > tests/new_examples.rs ; tail --lines=+6 tests/visibility_example.rs | head --lines=-11 >> tests/new_examples.rs

makes sense, understood the problem completely.

The private mod for sealing has the same name. So the macro tries to create the duplicate of the same seals. Fix should be pretty easy, just include the name of the struct in seal :)

Thanks for the issue again, will fix it soon