The signature of parseJSONStream() constrains the input type to InputRange, but it seems like it actually requires a ForwardRange due to the calls to std.algorithm.skipOver() in lexer.d.
I was trying to call parseJSONStream() on a range of ubyte from a file (without reading the entire file into memory), using the basic approach:
auto fileRange = File("input.json").byChunk(4096).joiner;
auto tokens = parseJSONStream(fileRange);
This fails with a type error:
std_data_json-0.18.2/std_data_json/source/stdx/data/json/lexer.d(341,29): Error: template std.algorithm.searching.skipOver cannot deduce function from argument types !()(Result, string)
Is there better way to do this? Probably at the least, the template constraints for parseJSONStream() should be changed to ForwardRange, but support for InputRanges would allow incremental parsing from a file.
Also, here is a related open forum thread: http://forum.dlang.org/thread/cknqodckwwfouobwxzbe@forum.dlang.org
The signature of
parseJSONStream()constrains the input type toInputRange, but it seems like it actually requires aForwardRangedue to the calls to std.algorithm.skipOver() in lexer.d.I was trying to call
parseJSONStream()on a range of ubyte from a file (without reading the entire file into memory), using the basic approach:This fails with a type error:
std_data_json-0.18.2/std_data_json/source/stdx/data/json/lexer.d(341,29): Error: template std.algorithm.searching.skipOver cannot deduce function from argument types !()(Result, string)Is there better way to do this? Probably at the least, the template constraints for
parseJSONStream()should be changed toForwardRange, but support for InputRanges would allow incremental parsing from a file.Also, here is a related open forum thread: http://forum.dlang.org/thread/cknqodckwwfouobwxzbe@forum.dlang.org