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
Because a Box<T> is a pointer, we always know how much space it needs: a pointer takes up a usize amount of space.
Box<T>
usize
since a box always has the size of a usize, no matter what it's pointing to
These are false statements. For example,
assert_eq!(std::mem::size_of::<Box<str>>(), std::mem::size_of::<usize>() * 2); assert_eq!(std::mem::size_of::<Box<ToString>>(), std::mem::size_of::<usize>() * 2);
It would be nice to clarify this (maybe in a footnote) whilst keeping it simple for purposes of the example.
The text was updated successfully, but these errors were encountered:
Ooooops. Yeah, I'll reword this next time we get this chapter back from nostarch so that at least it's not incorrect. Thanks!!! ❤️
Sorry, something went wrong.
Dance around the exact size of a box since it's really 2 usizes
f0d5678
Fixes #606.
So, a box on its own is always a usize. A trait object isn't just a box.
aa13bc1
No branches or pull requests
These are false statements. For example,
It would be nice to clarify this (maybe in a footnote) whilst keeping it simple for purposes of the example.
The text was updated successfully, but these errors were encountered: