Skip to content
New issue

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

style: use poll loop for CallState #779

Merged
merged 1 commit into from
May 25, 2024
Merged

Conversation

mattsse
Copy link
Member

@mattsse mattsse commented May 25, 2024

transforms the separate CallState::poll_ functions into a single poll loop.

this effectively replaces a waker call with a loop so the response is polled (started) right await without going through the scheduler

@prestwich
Copy link
Member

the other idiom i've been moving towards is an explicit continuation:

*self = Self::Running(fut);
self.poll_running(cx)
}

@mattsse
Copy link
Member Author

mattsse commented May 25, 2024

this also works, but this becomes more tricky if the state machine is >2 states or has more complex transitions

@prestwich prestwich merged commit 0f97116 into main May 25, 2024
24 checks passed
@prestwich prestwich deleted the matt/refactor-poll-loop branch May 25, 2024 12:37
ben186 pushed a commit to ben186/alloy that referenced this pull request Jul 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants