this post was submitted on 29 Jul 2023
12 points (92.9% liked)
Rust
6340 readers
27 users here now
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Wormhole
Credits
- The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
So what! Who cares if it's free? Write first, profile and optimize later. Not everyone cares about whether the conversion is free. Simply matching and converting to the right integer is fast enough.
The reason I asked the question, was that I wanted to keep an
int
anint
throughout the program.It's not for performance reasons, it's just that I feel like there is a certain elegance in keeping things type safe entirely "for free" much like how
Option<&T>
is actually just a regularT*
, even if it could be pointless in the big picture.