We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Self
When I had this trait for transitions relating to my Opened state everything worked as expected with the new function making Opened the start state.
Opened
new
pub trait Opened { fn new() -> Opened; // ... }
However, changing the return value for new from Opened to Self causes the macro to abort with several errors, beginning with:
error: Missing initial state. To declare an initial state you can use a function with signature like fn f() -> T where T is a declared state.
fn f() -> T
T
It would be nicer, I think, if I could use -> Self because it helps make the initial state stand out.
-> Self
The text was updated successfully, but these errors were encountered:
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:
typestate-rs/typestate-proc-macro/src/visitors/transition.rs
Lines 295 to 312 in ad6c902
If the function knows which state is it part of, it can return the correct ident
ident
Sorry, something went wrong.
No branches or pull requests
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.The text was updated successfully, but these errors were encountered: