Replies: 2 comments 1 reply
-
Hmm do you have an example impl that doesn't allocate on a |
Beta Was this translation helpful? Give feedback.
-
@kaffarell an example here - The record_str implementation has to create a owned String to be used outside the scope of this method, irrespective of the fact that |
Beta Was this translation helpful? Give feedback.
-
I’m new here and not familiar with the codebase, so this is more of a question than a suggestion. I was wondering if it would make sense to have a
record_static_str
method in the Visit trait for handling static strings. The goal would be to allow optimizations for static strings and avoid unnecessary allocations for those cases where it might be beneficial.Something like:
This could default to
record_str
for backward compatibility, but it might allow implementations to (micro)optimize for static strings and avoid allocations.Sorry if I am missing something basic, and there are reasons why static and non-static strings don’t need to (or can't) be differentiated in this context?
Beta Was this translation helpful? Give feedback.
All reactions