Hacker News new | ask | show | jobs
by josephg 1583 days ago
Yeah those utility methods will be inlined anyway by the compiler. But copy+paste (with a comment for attribution) is still probably the right tool here.

I like the idea of adding a slice type. What use case do you have in mind for that?

1 comments

I don't know about other people, but my tokenizer is parameterized over string slice types. So I tokenize from a slice (be it &str or ropey's RopeSlice) and some of the returned tokens have subslices. This allows tokenization to do no heap allocation.