Closed cecton closed 1 year ago
one could just as easily write format!("{}", 42).into(), could one not?
Sometimes yes... but in yew you need to specify the type because it cannot infer it when used directly in props. So, often you need to write AttrValue::from(format!(...))
.
let stuff = format!("").into()
html! {
<MyComponent {stuff} /> <--- often fails with "type annotations needed"
}
Not sure if I like this, since it requires that the correct
IString
is in context
It was actually done on purpose that IString must be in scope. It's a bit like String is always in scope. I did exactly because there are 2 distinct implementations.
Also it's not in the prelude of the crate. Not super invasive nor high maintenance
I'm adding iarray![]
which I also find is missing ^_^
I think I'm making the matter worst haha xD
It's okay I don't absolutely want macros. It's okay to disagree
This will invoke ToString, which may end up cloning the data inside, and thus violate the "reference count increase or 'static" API. I'm not sure how I feel about this
This will invoke ToString, which may end up cloning the data inside, and thus violate the "reference count increase or 'static" API. I'm not sure how I feel about this
ahh... you think? ... :thinking: only iformat!()
you mean? Ah yes format!()
itself could...
idk... I don't mind closing it for now. Though I guess people would expect that iformat, just like format, would allocate.
I will re-open it in the future if I feel this feature is really worthy.
Not sure if I like this, since it requires that the correct
IString
is in context (eithersync
orunsync
) and one could just as easily writeformat!("{}", 42).into()
, could one not?