-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Add documentation on trait objects. #22106
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
❤️ (It's probably better if I don't review, given I wrote a lot of it.) |
Hehe, yeah, I thought about it, and decided to let @rust-highfive do its thing. The edits are actually very small. |
binary, one for each type. | ||
|
||
Furthermore, compilers aren’t perfect and may “optimise” code to become slower. | ||
For example, functions inlined too eagerly will bloating the instruction cache |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will end up bloating?
Nice! A few small nits and otherwise r=me |
4de5b3f
to
dbccd70
Compare
|
||
However, the common case is that it is more efficient to use static dispatch, | ||
and one can always have a thin statically-dispatched wrapper function that does | ||
a dynamic, but not vice versa, meaning static calls are more flexible. The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/does a dynamic/does a dynamic call/?
…lexcrichton I started to write up some docs on this, and then realized I was just repeating http://huonw.github.io/blog/2015/01/peeking-inside-trait-objects/ but worse. @huonw previously said that we can use this content if we wanted, so I made some tweaks and integrated it into the book. Fixes rust-lang#21707
I started to write up some docs on this, and then realized I was just repeating http://huonw.github.io/blog/2015/01/peeking-inside-trait-objects/ but worse. @huonw previously said that we can use this content if we wanted, so I made some tweaks and integrated it into the book. Fixes rust-lang#21707
I started to write up some docs on this, and then realized I was just repeating http://huonw.github.io/blog/2015/01/peeking-inside-trait-objects/ but worse. @huonw previously said that we can use this content if we wanted, so I made some tweaks and integrated it into the book.
Fixes #21707