this post was submitted on 08 Mar 2025
10 points (91.7% liked)
Rust Programming
8553 readers
2 users here now
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
This is too simplistic example to give any meaningful answer. What’s
Type
? What’svalue
? If it’si32
and42
than they both compile to the exact same thing. But ifType
isDrop
than the second will call the destructor on each iteration. (I’ve also written previously about similar example withBorrowedBuf
^1^).