Currently the ranking and highlighting code is duplicated in filter.zig (rankToken() and highlightToken()). This makes some things more clear (each function returns a specific type, no unneeded args), and it also should make the function more performant. But it is an occasional burden to remember to update both functions.
A quick brainthought makes me think we could leverage comptime arguments to specify which version of the function to use (return the rank vs return the matched buffers) and not suffer any runtime performance penalty. I'll look into this...
Currently the ranking and highlighting code is duplicated in
filter.zig
(rankToken()
andhighlightToken()
). This makes some things more clear (each function returns a specific type, no unneeded args), and it also should make the function more performant. But it is an occasional burden to remember to update both functions.A quick brainthought makes me think we could leverage
comptime
arguments to specify which version of the function to use (return the rank vs return the matched buffers) and not suffer any runtime performance penalty. I'll look into this...