turbohz@programming.dev to Rust@programming.devEnglish · 11 days agoThe Hidden Rules Behind Rust Functions & Closuresblog.cuongle.devexternal-linkmessage-square4fedilinkarrow-up141arrow-down11
arrow-up140arrow-down1external-linkThe Hidden Rules Behind Rust Functions & Closuresblog.cuongle.devturbohz@programming.dev to Rust@programming.devEnglish · 11 days agomessage-square4fedilink
minus-squarecalcopiritus@lemmy.worldlinkfedilinkarrow-up8·edit-210 days agoWell, the closure has a type. Just you cannot declare it. That’s why you do “impl Fn” instead. Because you know that whatever type the close is, it implements the “Fn” trait.
Well, the closure has a type. Just you cannot declare it. That’s why you do “impl Fn” instead. Because you know that whatever type the close is, it implements the “Fn” trait.