Closed matthewsanetra closed 2 years ago
@matthewsanetra Regarding point 6, when we take uint
as an input parameter, it is aliased to uint32
, I believe. To avoid any superfluous casting on the user's side, what do you think about using constraints.Unsigned
, which includes all uint
flavors?
what do you think about using
constraints.Unsigned
, which includes alluint
flavors?
Very good idea! Changing now.
Woohoo! Tests passed. Merging.
@matthewsanetra thanks for the updates! Great stuff 🚀
Per discussion in #3, I've implemented
SkipRunes
,DropRunes
.I have also made the following changes:
DropString
unsafe
and avoid the extra allocation, but at the time I figured it wasn't worth it as . Since then I have foundstrings.Builder
, which internally performs theunsafe
conversion and saves us an allocation.append
inDrop
append
, but we can eliminate that by just making the slice with the final length at the beginning and copying the elements withcopy
. Should have no (negative) change in performance as all allocations in Go are zero'd anyways (so no internal optimisations done byappend
).Skip
,SkipString
Drop
, but notSkip
, and so now we return a slice of the same underlying array, but with length 0, maintaining a reference to that underlying array.Skip
,Drop
,... to non-negative integersUnskip
method, and it is up to debate whether we would ever expose such functionality (re. idiomaticity)String
functions into their own fileRunes
functions are in their own file.