What if VText.value
/ AttributeValue::Text
were Cow<'static, str>
instead of String
?
#2876
EndilWayfare
started this conversation in
Ideas
Replies: 1 comment
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I find there are many cases where a "dynamic" value isn't "potentially any arbitrary string" but rather "generally or always one of a finite number of strings known at compile-time."
For example,
The icon and class can change at runtime and/or be different among multiple instantiations of this component, but there's never any reason for them to be heap-allocated strings. Certainly not before they cross the javascript threshold into DOM land, which likely would involve at least one clone even if they were
String
s already.Even in cases where it resolves to a static value that is only rendered once and never re-evaluated, I'm allergic to
"static str".to_string()
.Likely Implies Prop-Passing Improvement
Since it would then be a "first tier" core library type.
But, even with no change to nodes/attributes, I would really like to have this props thing 😈
Beta Was this translation helpful? Give feedback.
All reactions