schveiguy / iopipe

D language library for modular io
Boost Software License 1.0
77 stars 6 forks source link

Change byLine pipe into byDelim, which works with any element type #3

Open schveiguy opened 7 years ago

schveiguy commented 7 years ago

Currently, byLine requires char/wchar/dchar ranges to operate. However, the range operation itself is simply an array or element matching search. There is nothing to stop it from searching for an array of any type in a buffer of that type.

a more general approach is to split the function into a byDelim which accepts an array or element to use as a delimeter, and a byLine function which converts a given dchar or some string into an array of code units to search with, that then can construct the byDelim range.

All of this should be seamless with the current API, and still be subject to the fantastic optimizations that have already been realized. See #2 for more discussion.