-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
Notes on SIZE_HINT #797
Comments
I don't think it's possible to override the default ToString implementation until
|
Oh, right! Thanks for the clarification.
|
Yeah, as far as I can tell neither a Would you be able to send a PR for some of the suggested documentation improvements? |
Yep, will do! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The docs for SIZE_HINT say:
It would be useful to say which way "conservative" means - I assume it means to err on the side of too low rather than too high.
Also, The Rust Performance Book suggests using
eprintln!
on a sample workload to print sizes in order to decide what a good pre-reserved capacity is. It might be nice to offer some handy way to do that for a given template. Maybe debug / trace logging?By my reading of the source, SIZE_HINT only applies to calling
render()
on a template, notrender_into
, using theDisplay
impl, or using the (blanket)ToString
impl. That should probably be documented, along with the impact on sub-templates.Also, I think Template could implement ToString to bypass the blanket ToString impl on Display items. Template's implementation could pre-reserve based on SIZE_HINT.
The text was updated successfully, but these errors were encountered: