Change ToPrimitive()
(to_primitive()
) hint to be an enum, instead of string
#466
Labels
E-Easy
Easy
execution
Issues or PRs related to code execution
good first issue
Good for newcomers
performance
Performance related changes and issues
technical debt
Milestone
What's wrong with the current implementation of
to_primitive
?The problem is that we use a string (
&str
) as the hint, so when we useto_primitive
we always have to do a string comparison, which is not efficient.To fix this we need to create a new enum
PreferredType
which would containString
,Number
andDefault
field and use it to compare it instead of&str
More information:
to_primitive
implementationThe text was updated successfully, but these errors were encountered: