You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to efficiently convert an integer to a smartstring (actually, I want to append it at the end of a smartstring). String has the ToString trait so you can just mystr.push_str(43.to_string()), but there does not seem to be any equivalent for smartstring, unless you convert String to smartstring (but this would allocate then free which would be a perf issue for me).
Any recommendation on how to proceed ?
The text was updated successfully, but these errors were encountered:
Actually I realized I can use write!() macro to format the number in the smartstring.
It might be difficult to avoid allocation
I meant that I don't want a forced allocation on the typical path (numbers < 64, fixed string prefix of 8 char). Allocating if there is a functional need is ok.
Hi,
I was trying to efficiently convert an integer to a smartstring (actually, I want to append it at the end of a smartstring).
String
has theToString
trait so you can justmystr.push_str(43.to_string())
, but there does not seem to be any equivalent for smartstring, unless you convertString
to smartstring (but this would allocate then free which would be a perf issue for me).Any recommendation on how to proceed ?
The text was updated successfully, but these errors were encountered: