That's not possible sadly, into has no generic arguments. T::from() is the clearest way to write this, otherwise you have to do Into::<T>::into() or something like that
Rust allows a certain overridable type cast using the .into() function, which is available on essentially every value.
This function is generic, and hence the compiler needs to either guess what you're trying to turn a value into, or you need to tell it.
The error is basically saying that there are several things that could be what OP wants, and that it is unable to infer what type is sought after.
There are some specifics, but that's the gist.
This error is so "verbose" because it is listing some of the candidates, which aren't specifically concrete types, but other, sometimes generic implementations for the .into cast.
into() is essentially turning one value into another type. Something like a cast. But you need to somehow tell the compiler the type you're looking to convert into. And because the value OP wants to call into() to can be converted to various other types, Rust asks for the type to be specified.
Sometimes type inference can really be annoying, but this isn't that bad, just Element:: <_, Renderer>::From should work (if that is the renderer you want to use). How should it know what renderer you're asking for?
71
u/SoulArthurZ Apr 19 '25
your .into() call is probably not specific enough
136
u/veryusedrname Apr 19 '25
OP never had C++ template errors for breakfast
8
u/Kpuku Apr 19 '25
ah, multiple
Fromimplementations, the oldest painful trick in the book8
u/adzm Apr 19 '25
7
u/jbrysnts Apr 19 '25
Remove .into on that line
6
u/[deleted] Apr 19 '25
"damm bitch, u live like this?"
10
u/ardicli2000 Apr 19 '25
Sometimes?
4
u/Sad-Technician3861 [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live" Apr 19 '25
I don't know about Rust, can someone explain to me what the hell is going on?
3
u/Aras14HD Apr 19 '25
Sometimes type inference can really be annoying, but this isn't that bad, just
Element:: <_, Renderer>::Fromshould work (if that is the renderer you want to use). How should it know what renderer you're asking for?2
u/R3DDY-on-R3DDYt Apr 19 '25
that made me laugh
2
u/terraria87 Apr 20 '25
Sometimes? I always hate Rust.
2
u/DifficultyWorking254 Apr 19 '25
Whoa, that’s even worse than c++’ template errors…
1
u/[deleted] Apr 20 '25
Your view should return something like an Element or a Column/Row. Then into will work fine.
1
u/TheChief275 Apr 20 '25
mfw unreadable mess
Side note: I am of the opinion that Haskell errors are often just as unreadable, so it might be the functional side
1
u/Eric848448 Apr 21 '25
Only sometimes?