3 ms·
how would you use it in practice? i'm guessing, but seems like it would be somewhat heavyweight. does anyone end up doing this, or just using raw ints? thinkin
by dilap 8y ago
how would you use it in practice? i'm guessing, but seems like it would be somewhat heavyweight. does anyone end up doing this, or just using raw ints?
thinking in comparison of something like go, where you'd just do
> type NodeIndex int
- Inityx 8y agoNewtypes are actually zero overhead abstractions; one prominent example of Newtype is the structs Instant and Duration from std::time: https://doc.rust-lang.org/std/time/index.html https://doc.rust-lang.org/std/time/index.html
- dilap 8y agoah, i meant heavyweight (middle-weight, maybe) in terms of programmer-effort / ergonomics. i know rust is all about zero-runtime-cost abstractions :-)