Content pfp
Content
@
0 reply
0 recast
0 reaction

Agost Biro pfp
Agost Biro
@agostbiro
Let’s try a more difficult one with closures. What’s wrong with this closure let closure = |x: &str| x;
6 replies
0 recast
4 reactions

franco pfp
franco
@francos.eth
You would need to specify a lifetime since you’re returning a borrowed reference. I don’t remember right now if you can annotate lifetimes in closures 😅 but you could do: let closure = |x: &str| x.to_owned();
2 replies
0 recast
1 reaction

makemake  pfp
makemake
@makemake
probably something ownership/lifetime related?
1 reply
0 recast
1 reaction

grayman pfp
grayman
@grayman
Isn't "let closure = x;" doing the same thing as "let closure = |x: &str| x;"?
1 reply
0 recast
1 reaction

desmo pfp
desmo
@desmo
the lifetime?
0 reply
0 recast
1 reaction

Dashingluc1 pfp
Dashingluc1
@dashingluc1
I will surely learn this language
0 reply
0 recast
1 reaction

Adophilus  pfp
Adophilus
@adophilus
I actually have no idea 😞😞
0 reply
0 recast
0 reaction