3 ms·
Depends on what you're doing; see https://crates.io/crates/init_with https://crates.io/crates/init_with as one example. It's not the exact same thing, and yeah,
by steveklabnik 10y ago
Depends on what you're doing; see https://crates.io/crates/init_with https://crates.io/crates/init_with as one example. It's not the exact same thing, and yeah, I would argue that's one area where it's okay to not totally abstract it. Rules are meant to be broken. (I was thinking about removing bounds checks with get_unchecked as well).
- vvanders 10y agoThat's a much more involved use case that I usually have. Looks like a solid abstraction though. Like I said, not really an issue, just a common pattern that I see.
- steveklabnik 10y agoAbsolutely, understood. Ironically, this is also a good example of how unsafe is complicated; "hey make an array (not vector) of copies of this thing" has lots of edge cases!