Is `struct Dip(f32)` always as fast as `f32`?
⚓ Rust 📅 2025-06-07 👤 surdeus 👁️ 13I have some UI layout code, and I was thinking of creating a new type to help keep my units straight.
/// Device independent pixels
struct Dip(f32)
impl Add for Dip { ... }
impl Mul for Dip { ... }
...
Is this always going to be as fast as raw f32? I remember a C++ talk called something like "There are no zero cost abstractions".
7 posts - 6 participants
🏷️ rust_feed