top | item 45046825

(no title)

Rusky | 6 months ago

> I'd be fine writing `.into()` or `.trunc()`

Yes, this is specifically what I'm disagreeing with.

> I fully expect that such methods will be inlined, likely even in debug mode (e.g. `#[inline(always)]`), and compile down to the same minimal instructions.

That's the cost to compile time I mentioned.

discuss

order

JoshTriplett|6 months ago

Many things in the language theoretically go through a trait as well, except that we have special cases in the compiler to handle those traits more efficiently. If this were a performance issue, there's no reason we couldn't do the same for `.trunc()` or `.into()`.