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

2.1 "The Future Trait" introduces a confusing (to me) example #131

Open
LighthouseJ opened this issue Apr 8, 2021 · 0 comments
Open

2.1 "The Future Trait" introduces a confusing (to me) example #131

LighthouseJ opened this issue Apr 8, 2021 · 0 comments

Comments

@LighthouseJ
Copy link

I was sort of familiar with async/await, enough to get into trouble and decided to finally read the async book from the start and really understand it or at least gain a better understanding.

I totally got the Rust-specific parts about purpose of poll(), what the Output type was, etc... I got to 2.1, and for discussion, it introduces SimpleFuture as a boiled-down version of the real Future trait, but it confused me because it was a copy of the real Future trait, but why wasn't (at least excerpts) from Future used instead?

I write C++ actively daily too and I'm familiar with its "named requirements" (https://en.cppreference.com/w/cpp/named_req) which are an informal collection of methods that must be implemented to satisfy a specific interface. These collections may be considered something of a trait. I got confused because I didn't know if I could use any trait I wanted to make as long as it has an "Output" type, and a poll function?

Can this section be modified to add caveats to clear up what the role of SimpleFuture is and that readers should use the real Future, or just show readers snippets from the real Future trait altogether?

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

No branches or pull requests

1 participant