turbohz@programming.dev to Rust@programming.devEnglish · 3 months agoThe Hidden Rules Behind Rust Functions & Closuresblog.cuongle.devexternal-linkmessage-square4linkfedilinkarrow-up141arrow-down11
arrow-up140arrow-down1external-linkThe Hidden Rules Behind Rust Functions & Closuresblog.cuongle.devturbohz@programming.dev to Rust@programming.devEnglish · 3 months agomessage-square4linkfedilink
minus-squarecalcopiritus@lemmy.worldlinkfedilinkarrow-up9·edit-23 months 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.