snaggen@programming.dev to Rust@programming.dev · 2 years agoAnnouncing Rust 1.79.0blog.rust-lang.orgexternal-linkmessage-square3linkfedilinkarrow-up177arrow-down11
arrow-up176arrow-down1external-linkAnnouncing Rust 1.79.0blog.rust-lang.orgsnaggen@programming.dev to Rust@programming.dev · 2 years agomessage-square3linkfedilink
minus-squarecalcopiritus@lemmy.worldlinkfedilinkarrow-up3arrow-down1·2 years agoI don’t understand what the advantages of const expressions are. Isn’t const { None } the same as just None?
minus-squaretaladar@sh.itjust.workslinkfedilinkarrow-up7·2 years agoconst expressions are evaluated at compile time and can be used in locations where you would have to otherwise specify a literal (or something that amounts to a named literal like a const value).
I don’t understand what the advantages of const expressions are.
Isn’t
const { None }the same as justNone?const expressions are evaluated at compile time and can be used in locations where you would have to otherwise specify a literal (or something that amounts to a named literal like a const value).