Open mx00s opened 2 years ago
Hello! Thank you for submitting this issue!
The fix should be simple enough. However, the part of the code that handles that needs a bit of refactoring.
The following function and friends should have more context on the current state: https://github.com/rustype/typestate-rs/blob/ad6c9022f5dc001424ec59f2cea585328d38a740/typestate-proc-macro/src/visitors/transition.rs#L295-L312
If the function knows which state is it part of, it can return the correct ident
When I had this trait for transitions relating to my
Opened
state everything worked as expected with thenew
function makingOpened
the start state.However, changing the return value for
new
fromOpened
toSelf
causes the macro to abort with several errors, beginning with:It would be nicer, I think, if I could use
-> Self
because it helps make the initial state stand out.