turbohz@programming.dev to Rust@programming.devEnglish · 17 days 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 · 17 days agomessage-square4linkfedilink
minus-squarecalcopiritus@lemmy.worldlinkfedilinkarrow-up9·edit-217 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.